What was that thing about saving standalones?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6159
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

What was that thing about saving standalones?

Post by dunbarx » Mon Feb 23, 2015 4:47 pm

My memory...

Simple splash stack arrangements no longer work in Mavericks and above? Do I recall a discussion about this not long ago? I really liked that method. Is it gone? I just tried to make such a gadget, and a separate stack file attached to the executable will not save its data, like it did in the old days. Is there a new trick for splash, or does everything have to migrate to external text files? Please say it ain't so.

Craig

Klaus
Posts: 11194
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: What was that thing about saving standalones?

Post by Klaus » Mon Feb 23, 2015 5:00 pm

Hi Craig,

do you have your separate stack(s) in -> specialfolderpath("engine")?
That folder is taboo (for writing) and has always been! 8)

Copy your stack(s) to -> specialfolderpath("documents") or the users prefs-folder
when the app starts the very first time.


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: What was that thing about saving standalones?

Post by FourthWorld » Mon Feb 23, 2015 5:31 pm

dunbarx wrote:Simple splash stack arrangements no longer work in Mavericks and above? Do I recall a discussion about this not long ago? I really liked that method. Is it gone? I just tried to make such a gadget, and a separate stack file attached to the executable will not save its data, like it did in the old days. Is there a new trick for splash, or does everything have to migrate to external text files? Please say it ain't so.
Apple now requires control of the format of files in the Preferences folder, but AFAIK they still allow developers to use their own binary formats for everything else.

The ability to write to the Applications folder has AFAIK always been limited by user permissions in OS X, as with any Unix system. So for the sake of the majority of our users whom we hope are running with non-admin accounts for security reasons, anything writable should be in an explicitly user-writable space, such as the Documents folder as Klaus suggested, or Application Support.

There are many ways to put stack files there, including writing your own installer in LC like RunRev does, but perhaps the simplest is to have a stack in your app's stack file that you clone and set the file name to a user-writable space, and then use the save command to save it there.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6159
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: What was that thing about saving standalones?

Post by dunbarx » Mon Feb 23, 2015 6:56 pm

Thank you, gentlemen. That worked just fine. I even understand it, and it is not too onerous.

Hate to be a bother, but I despise Windows, and wonder if you might suggest a folder similar to the "documents" folder that would be suitable. I must write a standalone for that (sound of hawking and spitting...) platform.

Craig

Klaus
Posts: 11194
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: What was that thing about saving standalones?

Post by Klaus » Mon Feb 23, 2015 6:59 pm

Hi Craig,
...a folder similar to the "documents" folder...
On Windows? Try -> specialfolderpath("documents")
:D


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6159
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: What was that thing about saving standalones?

Post by dunbarx » Mon Feb 23, 2015 7:27 pm

Klaus.

(Wipes mouth from earlier, badly aimed expectoration...)

Makes sense. I actually need to make both platforms work in the same office, so I will test the platform and reference the working stack accordingly.

Thanks.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: What was that thing about saving standalones?

Post by FourthWorld » Mon Feb 23, 2015 8:37 pm

dunbarx wrote:Hate to be a bother, but I despise Windows, and wonder if you might suggest a folder similar to the "documents" folder that would be suitable. I must write a standalone for that (sound of hawking and spitting...) platform.
Klaus' suggestion of specialFolderPath("documents") is a good one since Mac, Windows, and Linux all support a Documents folder in the user's Home folder.

That said, Documents is ideally where we'd store true documents, things the user has explicitly chosen to save there.

For non-document files used by an application, the HIGs for each OS suggest a different folder:
OS X: /Users/<userName>/Library/Application Support/
Windows: <driveLetter>:/Users/<userName>/AppData/Local/
Linux: /home/<userName>/.<yourappname>/

LiveCode can use OS constants where available for many special folders. For example, this will get the Application Data folder on Windows:

specialFolderPath(26)

Unfortunately, using specialFolderPath("asup") on OS X will return the system App Support folder, not the one in user-space guaranteed to be user-writable.

Anyone here know the constant for Application Support in user space?

I've been concatenating it from parts of $HOME and "asup", but I'd like to think Apple has an easier way we can use within LC.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm
Location: France

Re: What was that thing about saving standalones?

Post by atout66 » Wed May 13, 2015 9:42 pm

OK, so if I code something like below:

Code: Select all

put specialFolderPath(Documents) into lePath
do you know if I can be sure that "Documents" folder exists on all plateforme (Mac,Win,Linux, IOS,And) ?

Because in the dictionnary I have (6.5 version) it seems to be more complicated to store config files...

Thanks in advance, Jean-Paul.
Discovering LiveCode Community 6.5.2.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6159
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: What was that thing about saving standalones?

Post by dunbarx » Wed May 13, 2015 10:07 pm

Hi.

You can always:

Code: Select all

if there is a folder "documentsFolderPath" then..
Craig

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm
Location: France

Re: What was that thing about saving standalones?

Post by atout66 » Thu May 14, 2015 11:45 am

OK, thanks Craig :-)
Discovering LiveCode Community 6.5.2.

Post Reply

Return to “Talking LiveCode”