Standalone not saving changes

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

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Tue Nov 29, 2022 12:08 pm

Hi,
Thanks, Stam. You wrote
" But be aware than not uncommonly the /Applications folder is read-only, so if your app resides there, it won't save stuff. That's why the stacks may reside in other folders, such as specialFolderPath("support") and specialFolderPath("documents"), which are writeable locations."

I'm on Windows, and keep the LC files in a desktop folder named Livecode. Is this the "/Applications" folder you mention ? How would I know if it's a 'read only' folder ? How would I keep the files in a special folder path folder ?

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Standalone not saving changes

Post by stam » Tue Nov 29, 2022 12:23 pm

Hi CAsba,

No, the Applications folder is the one designated for applications - on windows it will be something like "Program Files" and Program Files (x86). On MacOS it's /Applications and I'm guessing something similar on Linux.

On windows if you look at your C: drive and right click on the Program Files folder, select 'Properties' then the 'Security' tab you can view permissions for various groups who can access this folder. On a work PC, I see the permissions groups for this include for ALL APPLICATION PACKAGES and ALL RESTRICTED APP PACKAGES. On my system, the permissions granted to these are: Read & Execute, List Folder Contents and Read, but not write.

In general though you want your data safely separated from your app. If not, and if you want to update/upgrade your app at some point, you'll have to migrate the old data into the new app, which can be a world of pain. If on the other hand you separate the data, it means you can delete/update/upgrade your app and not worry about migrating the data as it will still be available.

If you want users to be able to see/view/edit the data (eg in a TSV text file) then C:\Users\<username>\Documents (or similar) is a good option - the shortcut to your user's folder is specialFolderPath("documents").

If you don't want your users mucking around with the source data, then I'd probably put this in the appData folder (you can navigate to this in windows by hitting the Windows and R keys together to get the 'run' window and just type %appdata% and hit "OK". In this case, just create a folder within the AppData folder for your app and keep your data there. The shortcut to appData in LC is specialFolderPath("support").
(on MacOS, this is in /Users/<username/Library/Application Support/ -- but the same shortcut finds this as well).

Hope that makes sense,
Stam
Last edited by stam on Tue Nov 29, 2022 12:28 pm, edited 3 times in total.

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

Re: Standalone not saving changes

Post by Klaus » Tue Nov 29, 2022 12:24 pm

The "Application" folder on Win is the folder where most, if not all, of your EXE files get installed to.
I think this is something like
-> Program files (x86)
or just
-> Program files

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Tue Nov 29, 2022 12:36 pm

Many thanks, gents, that sure helps.

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Tue Nov 29, 2022 1:05 pm

OK, I looked at the Program Files/Properties/Security and its status is ALL APPLICATION PACKAGES, with the permissions granted being like yours, Read and execute, list folder contents and read. Do I edit this or leave as it is ?

I would want to seperate the data, as you suggest, but not sure what actions to take to achieve this. Users should be able to see data, in the form of user-requested reports, using a programmed instruction, but be unable to edit, unless there is a programmed method to edit. By data, I mean data the user has previously entered, nothing to do with 'source' data, which I take to mean coding ?

Owner > Appdata > Local contains my desktop folder LIVECODE where all the LC files are stored. So I guess this is in accordance with your recommendation to prevent users mucking around with source data (but I'm still not sure what is 'source' data).

Further help required I think, and much appreciated..

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Standalone not saving changes

Post by stam » Tue Nov 29, 2022 9:05 pm

CAsba wrote:
Tue Nov 29, 2022 1:05 pm
OK, I looked at the Program Files/Properties/Security and its status is ALL APPLICATION PACKAGES, with the permissions granted being like yours, Read and execute, list folder contents and read. Do I edit this or leave as it is ?
I would definitely leave it as is! it's under 'security' for a reason!
CAsba wrote:
Tue Nov 29, 2022 1:05 pm
I would want to seperate the data, as you suggest, but not sure what actions to take to achieve this. Users should be able to see data, in the form of user-requested reports, using a programmed instruction, but be unable to edit, unless there is a programmed method to edit. By data, I mean data the user has previously entered, nothing to do with 'source' data, which I take to mean coding ?
The simple idea is that you would have file based storage for your data - be it another liveCode stack, a text file, an SQLite file or whatever - this is what I mean by 'source data' - nothing to do with code. It's your data's "one source of truth' as it were.

Your app would read data from the file, use it, write back to file, rinse and repeat. You then display that data to users in your app by whatever means you think is best.

What I was referring to by users editing data is for example: if the app crashes or is no longer useable (say because you stopped developing it and it no longer works on a new version of an OS) then the users could still read the data in other apps, such as a text editor, SQLite reader etc. On the other hand, you may not want them to do that frivolously ;). Or at all - if you really don't want users to read the data in any way outside the app you encrypt the files (search online).

I guess a simpler starting point would be use tab-separated values in a simple text file - you'd just need to learn how to read/write such a file, which is fairly easy -- just search online. Once you read the text into a variable, you can then use that to populate your displays for the user.

HTH
Stam

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Wed Nov 30, 2022 11:50 am

Hi,
May I respectfully opine that I think we may have gone off the point I made; using the onopenstack script, I DID have a standalone that worked, saved data, no problems, without recourse to anything other than following the instructions in the lesson.
Subsequently, I was able to make standalones, but they did not save data changes.
Now, the standalone is made, to all visual respects it looks like the real thing (a square icon, in its own folder, together with a folder named 'externals') but now, on clicking on it, it doesn't even fire up !
I have made lots of experimental changes to the subsequent launch stacks' onopenstack code, but now, using the original onopenstack code, I have this new problem - it doesn't run.
I am at a loss of what to do next.

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Standalone not saving changes

Post by stam » Wed Nov 30, 2022 12:11 pm

Sorry, without providing some detail no one will be able to help you and that’s why the discussion veered off.

Perhaps you’d want to post some of the relevant code?

When I’m dealing with specific issues I will sometimes just create a new blank stack just with the code to work on (eg a splash stack launching another stack) without any other code that may be interfering so I can pin down the problem.

If you create a simplified stack showing the issue, you would probably get more relevant help - but otherwise people can only answer with speculation. Saying you had a working solution but now that you changed stuff it no longer works isn’t enough to go on, so you’ll only get vague/unhelpful replies.

And BTW - the code you post earlier in this thread isn’t enough to go on either - why don’t you create 2 new empty stacks and post them here which will help people answer your problem.

S.

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Wed Nov 30, 2022 12:15 pm

Thanks, Stam. Got it !

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Standalone not saving changes

Post by CAsba » Wed Nov 30, 2022 12:33 pm

I just had some success !
Following two actions, I'm not sure which was the causative one..
I re-started the computer.
I set the main application to the first (top) card in the project browser list prior to clicking make standalone.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”