absolute/relative path nightmare

Sarah Reichelt sarahr at genesearch.com.au
Tue May 24 18:32:28 EDT 2005


> I am completely baffled by this.
> OK I have a script in an app that looks for three files in a folder.
>
> EG master folder called armbase with an app called armbase.exe
> in folder armbase ther eis a folder called components.
> Within the folder called components ar ethe three files I want to 
> access. One is called armbase.txt one called armbase.xdf and another 
> called PDATconc.exe (I run PDATconv.exe from the shell command.
>
> OK here is the problem.
>
> If my script points to the full path eg in this case
>
snip
>
> Then the script works fine.
>
> However if I use truncated versions (what I think of as relative 
> paths) the app does not run the externals.
snip

> I thought that if the folder was in the same directory as the app then 
> it would work. I need this to work because it would save lots of 
> problems with running multiple versions.
>
Hi Bob,

However I tend not to reply on relative paths and use the full file 
path in nearly all cases. In order to make this work regardless of 
where the app is, I find the application's folder and use it to 
construct the full path e.g.

put myAppsFolder() & "\Components\PDATconv.exe" into tPath

To get your app's folder, get the filename of the main stack, set the 
itemDel to "/" and delete the last item.
If you are sending the result to the Windows shell, you will then need 
to replace "/" with "\".

HTH,
Sarah




More information about the use-livecode mailing list