Page 1 of 1

Path to a Copied File in Mac Standalone

Posted: Tue May 13, 2014 7:38 am
by icouto
I am developing a stack that is a GUI for a command-line tool, for MacOS X. I want to include the command-line tool itself with my standalone build.

I have added the command-line tool file in the "Copy Files" pane of the Standalone Application Settings dialog. When I build the standalone, it is indeed being copied into the bundle - it puts it right the same sub-directory as the main executable for the app. The questions that I have are:

1) How can I find the complete file path to the included file? I need to reference is on several shell() calls in my scripts![/1]
2) When I'm writing my scripts in the LiveCode IDE, I will have to use a certain path in shell() for the command-line tool. Once that tool is bundled in the standalone, the path will change. How will shell() know whether it's running from the IDE, or from a standalone - and adjust its path accordingly?

Or, is there an easier way to do this that I'm missing?...

Any guidance would be much appreciated.

Re: Path to a Copied File in Mac Standalone

Posted: Tue May 13, 2014 11:57 am
by Klaus
Hi Igor,
1) How can I find the complete file path to the included file? I need to reference is on several shell() calls in my scripts!
Ever right-clicked a Mac APP bundle and checked its content? :D
...

Code: Select all

## Gives the absolute pathname to the standalone (mainstack)
put the effective filename of this stack into tRuntime
set itemdel to "/"
put empty into item -1 of tFile
put tFile & "/" into tPathToYourCopiedFiles_including_CLI
...
2) When I'm writing my scripts in the LiveCode IDE, I will have to use a certain path in shell() for the command-line tool.
Once that tool is bundled in the standalone, the path will change.
How will shell() know whether it's running from the IDE, or from a standalone - and adjust its path accordingly?
SHELL() will only know this fact if you tell it! :D

Code: Select all

...
if the environment = "development" then
  ## do IDE stuff and supply IDE pathnames
else
  ## Do RUNTIME stuff, see above...
end if
... 
Best

Klaus

Re: Path to a Copied File in Mac Standalone

Posted: Tue May 13, 2014 2:29 pm
by icouto
Klaus, you're a gem: the effective filename and the environment were exactly what I was looking for!

Thank you so much! :-)

Side note: man, you've helped SO MANY people in these forums! You're amazing!

Re: Path to a Copied File in Mac Standalone

Posted: Tue May 13, 2014 4:18 pm
by Klaus
Yeah, isn't that suspicious somehow? :D