App with documents

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: App with documents

Post by shaosean » Sat Nov 26, 2016 4:33 am

Is the file being saved a user document file, or something that your program uses internally? If the former guess you can always prepend something to the stack name when it's loaded and then remove it when the stack is being saved.. If the latter are you saving it to the Application Support folder so the end user can't easily modify it?

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: App with documents

Post by Mag » Sat Nov 26, 2016 9:59 am

shaosean wrote:Is the file being saved a user document file, or something that your program uses internally? If the former guess you can always prepend something to the stack name when it's loaded and then remove it when the stack is being saved.. If the latter are you saving it to the Application Support folder so the end user can't easily modify it?
Hi shaosean, thank you for your post. The file is saved in the location the user choose to save it, and the user has full access to the file in the Finder. Like a doc of Pages or Word.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: App with documents

Post by shaosean » Sat Nov 26, 2016 1:06 pm

I just created a stack and called it "turkey" from within the IDE.. I saved it to my Documents folder, quit LiveCode and then renamed the stack file to "1".. Reopened the stack in LiveCode and it's still called "turkey" in the IDE.. The filename property and the name property of the stack can be two different things.. So you could always prepend a string to the stack name to ensure that there is never a number as the first character..

Code: Select all

on saveStackRequest
   if (char 1 to 4 of the short name of this stack <> "moo_") then
      local tStackName
      put the short name of this stack into tStackName
      put "moo_" before tStackName
      set the name of this stack to tStackName
   end if
   pass saveStackRequest
end saveStackRequest
I didn't have much luck with this actually saving in the IDE, but the name of the stack did get changed and I am sure that there is something with the IDE tools (it works when I suspend the development tools, so should work in a compiled application as well)

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: App with documents

Post by shaosean » Sat Nov 26, 2016 1:07 pm

A little more work will be needed to handle the first time save using a number, but the idea is there..

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: App with documents

Post by Mag » Sat Dec 17, 2016 1:49 pm

Hi shaosean, really interesting info. I will do some tests.

Post Reply

Return to “Mac OS”