Simple Standalone for a Macintosh
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Simple Standalone for a Macintosh
There is a LiveCode lesson entitled "How do I save custom properties in a standalone application?" which can be found at http://lessons.livecode.com/m/4071/l/17 ... pplication. It works just fine if you make the standalone for a Windows computer but the Mac version does not work. Can anyone discuss what it takes to produce an executable that will run on a Mac?
I have attached copies of my "Splash" stack and "Main" stack as a starting point for anyone willing to try. Ideally I would like something that works like the Windows one - as a folder that can be located on the desktop and run from there. At this point, however, I will take anything that uses the "splash" method and works on a Mac.
Thanks for any light you can shed on this. It should be a lot simpler than it is.
Larry
P.S.
I was not able to attach my stacks so here are dropbox links:
https://www.dropbox.com/s/cig5ty3fzx2pp ... ecode?dl=0
https://www.dropbox.com/s/bc81m6z8carrt ... ecode?dl=0
I have attached copies of my "Splash" stack and "Main" stack as a starting point for anyone willing to try. Ideally I would like something that works like the Windows one - as a folder that can be located on the desktop and run from there. At this point, however, I will take anything that uses the "splash" method and works on a Mac.
Thanks for any light you can shed on this. It should be a lot simpler than it is.
Larry
P.S.
I was not able to attach my stacks so here are dropbox links:
https://www.dropbox.com/s/cig5ty3fzx2pp ... ecode?dl=0
https://www.dropbox.com/s/bc81m6z8carrt ... ecode?dl=0
Re: Simple Standalone for a Macintosh
I suspect that on OSX, the splash stack would work just fine if you save the actual stack to the documents location, not the app folder, if you see what I mean. Windows and Linux don't look at the app folder as the app (for the most part, there are situations where that can be the case).
I'm sure Klaus or someone else will chime in if I am completely off target here, or maybe even if I am right on target
I'm sure Klaus or someone else will chime in if I am completely off target here, or maybe even if I am right on target
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Simple Standalone for a Macintosh
Hi.
When you say "does not work" do you mean you cannot save information to the "Main" stack? Or you cannot make a standalone at all? You already know you cannot save to the "Splash" stack, which is the executable.
I do this on a Mac all the time. I save to one or more stacks and subStacks of stacks.
Craig
When you say "does not work" do you mean you cannot save information to the "Main" stack? Or you cannot make a standalone at all? You already know you cannot save to the "Splash" stack, which is the executable.
I do this on a Mac all the time. I save to one or more stacks and subStacks of stacks.
Craig
Re: Simple Standalone for a Macintosh
bogs,
When I put Launcher Test.app in the documents folder and run it from there it runs but will not save a changed name upon quitting and starting again.
dunbarx,
Yes. I mean it cannot save the information that gets changed. A re-start displays the old name. That applies for Launchere Test.app either on the desktop or in the documents folder as bogs suggested.
You say you can do this all the time. Can you do it with my stack? (the one in the lesson)
Larry
When I put Launcher Test.app in the documents folder and run it from there it runs but will not save a changed name upon quitting and starting again.
dunbarx,
Yes. I mean it cannot save the information that gets changed. A re-start displays the old name. That applies for Launchere Test.app either on the desktop or in the documents folder as bogs suggested.
You say you can do this all the time. Can you do it with my stack? (the one in the lesson)
Larry
Re: Simple Standalone for a Macintosh
I thought this sounds like a path issue, as in the launcher not knowing where to find the main application stack. Then I noticed in the comments for that lesson, near the end, you will see Ivan refers to an issue on Mac that sounds like yours, and provides a solution.
If that doesn't help, write back.
If that doesn't help, write back.
Re: Simple Standalone for a Macintosh
Sorry lohill, apparently I wasn't clear enough, I'll try again.
When you make a standalone for the Mac, the whole rig is put in a '.app' folder and treated as a monolithic executable file. That file acts as a standalone no matter where it is located, and you (normally) don't have write access to the objects inside of it by default.
What I was suggesting, however poorly, was turning the launcher stack into the executable as you normally would, and putting the stack the launcher launches outside of that and into the documents folder, or a folder in the documents folder, where the end user would DEFINITELY have write permissions.
In your launcher stack, you would refer to the saving stack by url, in this case using "special folder path", something like :
go stack (specialFolderPath("Documents") & slash & "foo.livecode"))
Of course, you would need to write the routine that puts the stack you want to save stuff in in that location. Off the top of my head, in the preOpenStack of the launcher stack, you'd write something like (not tested)
Code: Select all
on preOpenStack
# check to see if there is a file there...
set the defaultFolder to specialFolderPath("Documents")
if "foo.livecode" is not among the files then
answer "first run..."
copy stack "foo.livecode" to specialFolderPath("Documents")
end if
# continue with launching the stack using the special folderpath...
end preOpenStack
Re: Simple Standalone for a Macintosh
Hi all,
Apple had changed the structure of an APP package after the lesson mentioned above has been published, so this is in fact a path issue.
1. Add your stack to your standalone via the "Copy files" tab in the "standalone application settings". Then you will find it here in your standalone -> specialfolderpath("resources")
However you need ADMIN rights to be able to save that stack if the APP is installed in the "Applications/Programm FIles" folder!
So you need to copy that stack to the users Docs folder as bogs suggested:
Best
Klaus
Apple had changed the structure of an APP package after the lesson mentioned above has been published, so this is in fact a path issue.
1. Add your stack to your standalone via the "Copy files" tab in the "standalone application settings". Then you will find it here in your standalone -> specialfolderpath("resources")
Code: Select all
...
## SPLASH stack:
go stack (specialfolderpath("resources") & "/foo.livecode")
...
So you need to copy that stack to the users Docs folder as bogs suggested:
Code: Select all
on preOpenStack
# check to see if there is a file there...
put specialFolderPath("documents") & "/foo.livecode" into tTargetStack
put specialFolderPath("resources") & "/foo.livecode" into tSourceStack
## First run, copy stack to DOCS folder:
if there is not a file tTargetStack then then
put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
end if
## Go stack tTargetStack
## ...
end preOpenStack
Klaus
Re: Simple Standalone for a Macintosh
Thank you for the (much clearer) explanation and code Klaus, I thought it might be something like that, but unfortunately have no (current) OSX box to test on.
Re: Simple Standalone for a Macintosh
Thanks everyone. Klaus, I'm still trying to digest this. Are these two scripts to be placed in the Splash stack?
Then in the main stack whenever something needs to be saved you save it in the "target stack".
Larry
Then in the main stack whenever something needs to be saved you save it in the "target stack".
Larry
Re: Simple Standalone for a Macintosh
Hi Larry,
Once that stack has been opened it can be addressed by its name e.g.: stack "el stacko loco"
Best
Klaus
Yes.
Exactly!
Once that stack has been opened it can be addressed by its name e.g.: stack "el stacko loco"
Best
Klaus
Re: Simple Standalone for a Macintosh
Thanks Klaus. I have made a couple of stacks that demonstrate this simple case. They are in the zipped file which I have attached. The splash is called "Launcher.livecode" and the main program is called "Main Application.livecode". I have also included a folder called "Launcher Test Compiled" which contains the executables. I cannot test the Linux one so maybe someone else might. When the executable is run on a Mac a copy is placed in the documents folder and that is what gets updated. It is import to note that in updating this application for someone on a Mac, the copy of "Main Application.livecode" in the documents folder should be deleted prior to running the updated version. Now I have a lot more exploring to do with encrypting things.
As a side note this is important enough that the tutorial that LiveCode provides should point this out.
Larry
P.S. My zipped file that included the executable was too big so now it only includes the two source files and is called Forum.zip.
As a side note this is important enough that the tutorial that LiveCode provides should point this out.
Larry
P.S. My zipped file that included the executable was too big so now it only includes the two source files and is called Forum.zip.
- Attachments
-
- Forum.zip
- Source for Launcher Test
- (6.72 KiB) Downloaded 204 times