Problems saving stack in standalone

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 543
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Problems saving stack in standalone

Post by Simon Knight » Wed Nov 19, 2014 12:53 pm

Hi,
I am using a splashscreen to load my main app so that I am able to save the app stack and its user entered data. Unfortunately while the save command works ok in the IDE it fails in a standalone returning a result of "can't open stack backup file". Web research implies that this could be a problem with file permissions, I have changed all the folders in the built bundle to read/write but the file still will not save.

I have also tried various versions of the save command such as

Code: Select all

Save this stack
,

Code: Select all

Save stack "myStackNAme"
and

Code: Select all

Save stack (full path of stack)
all with the same result.

Any thoughts?

Simon
best wishes
Skids

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

Re: Problems saving stack in standalone

Post by Klaus » Wed Nov 19, 2014 1:54 pm

Hi Simon,

unless the user of your standalone has ADMIN permissions, he can NOT write (= save the stack) int Application folder!

Do this:
1. Check if your "main" stack is already in -> specialfolderpath("documents") or wherever you have write permissions!
2. I not, copy the actual "virgin" stack to that location. Add your stack to the standalone via the "Copy files" tab in the standalone builder.
3. If yes, do nothing and
4. Go to that namely stack

Get the picture?


Best

Klaus

Simon Knight
Posts: 543
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Problems saving stack in standalone

Post by Simon Knight » Wed Nov 19, 2014 2:58 pm

Hi Klaus,

Thanks for your reply.

My source code and builds are all a folder structure under my home folder and they have the same read/write permissions as my document folder. The application stack has the data/code stack added as a stack rather than under the copy files pane as you suggest as the copy files pane labelled with "non stack files" so I assume you meant the second pane.

On build these settings create a package folder with the compiled splash stack in Contents/MacOS/AppName.app and the other stacks in Contents/Resources/_MacOS/(Two stack files here) - I have read/write access to all levels of the package.

Perhaps it is just not possible to use the package app to write into its own package.

Simon
best wishes
Skids

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Problems saving stack in standalone

Post by LCNeil » Wed Nov 19, 2014 3:19 pm

Hi Simon,

I think what you are experiencing is a bug as there a few issues with saving a stack that has been launched by a launcher stack. More information on this can be found here-

http://quality.runrev.com/show_bug.cgi?id=13788

If this is the issue, then a workaround is to execute the following script to save. This should resolve the issue until a fix is available

Code: Select all

 set the itemDelimiter to slash  --- on standalone
      get the effective filename of this stack
      put item 1 to -3 of it into tPath
      put "/Resources/_MacOS" after tPath
      set the defaultFolder to tPath
      save this stack as "putnameofyourstackhere.livecode"

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

Simon Knight
Posts: 543
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Problems saving stack in standalone

Post by Simon Knight » Wed Nov 19, 2014 3:44 pm

Hi Neil,

Thanks for your post. I have just spent the past hour reading posts and convincing myself that it is not possible to do the save the way I am want :D .

So to be certain I understand: It should be possible to build a standalone that writes data back to a stack that is stored as a standard stack file within the it's package folder. However, at present there is a bug that prevents this from working.

I downloaded the stack associated with the bug report and see that the MainStack.Livecode is added in the "Copy Files" pane (sorry Klaus you did mean it). I have been adding my MAinStack.Livecode to the stacks pane, the end result seems to be the same i.e. in both cases the mainstack is copied to sub folder _MacOS inside the package so is "better" to use the "Copy Files" pane ?

I will report back on the success or otherwise I have with your work around.

Simon
best wishes
Skids

Simon Knight
Posts: 543
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Problems saving stack in standalone

Post by Simon Knight » Wed Nov 19, 2014 3:52 pm

Thanks Neil,

The work around works so it was the same bug so a BIG THANK YOU :!:

For a small nif naf project its caused some problems and caused me to doubt my sanity!

best wishes

Simon
best wishes
Skids

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Problems saving stack in standalone

Post by LCNeil » Wed Nov 19, 2014 3:58 pm

Hi Simon,

Any stacks that are present in the _MacOS directory will be writable.

These files were previously included the main MacOS directory but recent changes from Apple required this to be changed. More information on this can be found here-

http://quality.runrev.com/show_bug.cgi?id=13455

This change means , at present, a simple save stack "mainstack.livecode" will not work and the workaround needs to be used

I'm glad I was able to help :)

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Problems saving stack in standalone

Post by quailcreek » Thu Jul 02, 2015 9:11 pm

Hi,
I'm having a similar problem with my standalone except I don't save the main stack. I do save a number of client info stacks into the folder "Scoring Data/. I also open my main stack from a button on the splash screen stack. The exec gets placed into the Content/MacOS folder. The remaining stacks, files and folders get placed into the Resources/_MacOS folder. This is happening on my windows standalone too. What's failing is copying an updated card from the template stack (tTemplate) to the clients profile stack (gClientPath). I put in some code to check that the old card was renamed and the new card was copied. Everything works file in the IDE.

I'm using LC 6.7.5

Code: Select all

put GetDataOfIndex(the dgHilitedIndexes of me, "StackName") into gClientStackName -- the name of the Clients stack from the data grid

put (StackPath(the filename of this stack)  & "Scoring Data/" & gClientStackName & ".rev") into gClientPath

put (StackPath(the filename of this stack) & "Scoring Data/" & "Client Template.rev") into tTemplate

-- I need to copy the existing info from the original "Client Info" card to the new one so I rename it. It gets deleted later
set the name of cd "Client Info" of stack gClientPath to "Client Info_Old"
               
-- Check to see if the "Client Info" card was renamed. If so then copy the updated card from the template stack. LC answers it was copied.
               if there is a cd "Client Info_Old" of stack gClientPath then
                  copy cd "Client Info" of stack tTemplate to stack gClientPath
                  answer "Card copied"
               else
                  answer "No template file"
               end if
               
-- Check to make sure the card was copied. LC answers the "Client Info" isn't there
               if there is a cd "Client Info" of stack gClientPath then 
                  answer "Client Info"
               else
                  answer "No Client Info card"
               end if

function StackPath pPath
   set the itemDelimiter to slash
   
   if the platform = "MacOS" and the environment = "standalone application" then
      get the effective filename of stack pPath
      put item 1 to -3 of it into pPath
      put "/Resources/_MacOS" after pPath
      return pPath & "/"
   else
      delete last item of pPath -- remove the last item to get the path to the containing folder
      return pPath & "/"
   end if
end StackPath
Tom
MacBook Pro OS Mojave 10.14

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 72
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City
Contact:

Re: Problems saving stack in standalone

Post by tomBTG » Fri Jul 03, 2015 4:18 pm

quailcreek wrote:What's failing is copying an updated card from the template stack (tTemplate) to the clients profile stack (gClientPath). I put in some code to check that the old card was renamed and the new card was copied. Everything works file in the IDE.
Hi,

One possible cause is if you have password protection added to the stack during your standalone build. Password protection silently blocks copying of controls out of the protected stack. So if you are adding the PW protection during standalone build, that explains why your code works in the IDE and not as a standalone. (It's a feature, not a bug.)

If this sounds like the cause of the problem, try to workaround it by saving just the data and not a direct copy of the card itself. Put the data into a var and then save that as a cprop, text or whatever.

HTH,
Tom Bodine

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Problems saving stack in standalone

Post by quailcreek » Fri Jul 03, 2015 6:14 pm

Hi Tom,
Thank you!! The PW protection was the problem.
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Mac OS”