safe shell command

Alex Rice alrice at arcplanning.com
Fri Feb 21 12:55:01 EST 2003


On Thursday, February 20, 2003, at 11:18  PM, Richard K. Herz wrote:

> My understanding is that you need to get the path to the directory 
> where your exe is, e.g., from parsing "get the long name of this 
> stack", and then have the shell "cd" to that directory before running 
> the exe.  This is what the script I sent does.  The path to the 
> directory the exe is in gMyappPath originally.

I'm probably missing something, but I don't think that is necessary. 
shell() runs from the defaultFolder, and the only time the 
defaultFolder is not equal to the path of the main stack, is when you 
running in development platform, and in that case you can just fix up 
the defaultFolder property. So you don't need to cd to a path to 
execute a shell command, unless the command is actually located in an 
entirely different directory.

I just tested this on Windows2K Pro and it works as I described. Maybe 
it doesn't work on all versions of windows?

The reason I want to avoid doing it that way (cd-ing) is that I don't 
know enough about windows to  trust the Windows shell interpreter to 
use the same exact pathnames & volume names as Runrev is using with the 
long name of the stack. On Mac OS X, Revolution and Javascript 
represent volume names differently sometimes, (always?) and so it makes 
it a really tricky problem to tell javascript to cd before executing a 
shell() command. (all of which hopefully will go away when Rev gets a 
real shell() on OS X) However, I am just afraid there could be 
something similar going on in windows. Probably just being paranoid. 
But at the very least you are executing an extra command, no?

[cc: ing to the list to see if my understanding is correct.]

Thanks again,

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the use-livecode mailing list