Where to put app and how to reference it?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Where to put app and how to reference it?

Post by rumplestiltskin » Sat Aug 18, 2012 10:19 pm

Firstly: This is on a Mac running 10.8 and using LiveCode 4.6.4

I have a fairly simple app that is just acting as the GUI to some open source Unix Executable that is normally run in the Terminal. My app asks the user to specify a source file, the app concatenates the file path with the proper syntax for the executable and then I use "put shell(myConcatenation)". It works.

However, I'd like to include the open source app -inside- my app so I don't have to worry about the user having to download and install the executable in the "proper" location (where my app expects to find it).

So the two questions are:

1. How to I put the executable inside my app? (I know how to "show package contents" but I think there's a way to do this from within the stack inspector.)

2. What path do I use to call the code when I don't know exactly where the user will install my app?

Thanks in advance for any assistance.

Barry

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Where to put app and how to reference it?

Post by rumplestiltskin » Sat Aug 18, 2012 10:20 pm

One thing I forgot to mention: My app is free so whatever open source code I am using I am not charging for.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Where to put app and how to reference it?

Post by sturgis » Sat Aug 18, 2012 11:07 pm

Look in the standalone application settings, copy files pane.

You can select files and folders you wish to be bundled up in the app package.


When your app starts up, these files and folders should be in the root of the defaultfolder. You can store this path somewhere on startup if you have need to change where the defaultfolder is pointing, so that you always have a quick easy way to point to the executable you need to shell.

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Where to put app and how to reference it?

Post by rumplestiltskin » Sun Aug 19, 2012 12:50 am

So if I'm allowed to copy the executable into the app package, how do I test my app prior to making the standalone? Won't the paths be different?

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Where to put app and how to reference it?

Post by sturgis » Sun Aug 19, 2012 1:12 am

You can manually set the defaultfolder to point to where the executable is from the message box. In fact, you can add something like this..

if the environment is "development" then
get shell("/where/it/is/on/system")
else
get shell("where/it/is/in/standalone/package
end if

Then you can just use tPath in your shell.

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Where to put app and how to reference it?

Post by rumplestiltskin » Mon Aug 20, 2012 4:41 am

if the environment is "development" then
get shell("/where/it/is/on/system")
else
get shell("where/it/is/in/standalone/package")
end if
So where, exactly is ("where/it/is/in/standalone/package") in terms of a path the executable expects?

Thanks

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Where to put app and how to reference it?

Post by sturgis » Mon Aug 20, 2012 2:12 pm

To get the location do this

Code: Select all

put the effectivefilename of this stack into tPath
set the itemdelimiter to slash
delete the last item of tPath
tPath now points to the location in the app package that actually contains the executable. And the file you added with the "copy files" pane, should be right next to it.

If you added a folder using the copy files pane the folder should be there too.

So, you can then:

Code: Select all

set the defaultfolder to tPath

answer the files -- will open an answer box listing the files in the default location

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Where to put app and how to reference it?

Post by rumplestiltskin » Mon Aug 20, 2012 2:29 pm

A-ha! Now I understand. Just what I needed. Thanks very much for your patience.

Barry :D

Post Reply