IsAstack ( )

Brian Yennie briany at qldlearning.com
Mon Jul 2 05:37:10 CDT 2007


Only problem I see is that you are going to get false positives if  
the file actually IS a shell script. You might try nibbling a little  
more to get something Metacard/Rev specific.

Also, I know the file format has changed a couple of times in recent  
history -- you might need to check if they have finally banished the  
old Metacard shell script prelude, in which case the function would  
fail.

Lastly, I think your script is still going to load the whole stack  
into memory before reading off the first line. If you want to read  
just 1 line, you'll need to use open / read / close file commands.

Is there a compelling reason to not just check for the existence of  
the file, and that it has the appropriate file extension? Then also  
check for errors when actually opening the stack?

return ((there is a file pFilePath) AND (char -4 to -1 of pFilePath  
is ".rev"))

HTH,
Brian

> I need a robust alternative to "if there is  a stack pFilePath"  
> that does
> *not* load the file into memory and potentially  cause problems  
> with shared stack
> name space.
>
> Can anyone improve or see  anything not foolproof with this?
>
> function isAstack  pFilePath
> return line 1 of  url("file:"&pFilePath)="#!/bin/sh"
> end isAstack
>
> /H
>
>
>
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard



More information about the metacard mailing list