Creating LiveCode applications that play well with git

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Re: Creating LiveCode applications that play well with git

Postby trevordevore » Sun Jul 23, 2017 1:01 am

Try setting the behavior to the long id of the stack.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 835
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas

Re: Creating LiveCode applications that play well with git

Postby jim1001 » Sun Jul 23, 2017 2:22 pm

Try setting the behavior to the long id of the stack


As if by magic that worked - my guess is you knew it would :wink: Since it was already loaded into memory I thought the stack name was enough. Also, just putting "the long id" in front of the name isn't supplying any more information so a bit puzzling to me. The dictionary syntax wasn't clear when you need the long id.

Glad you were there with your knowledge - thanks!
jim1001
 
Posts: 103
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Postby trevordevore » Mon Jul 24, 2017 5:57 am

jim1001 wrote:Since it was already loaded into memory I thought the stack name was enough. Also, just putting "the long id" in front of the name isn't supplying any more information so a bit puzzling to me. The dictionary syntax wasn't clear when you need the long id.

Glad you were there with your knowledge - thanks!


You're welcome. I'm still puzzled as to why you are having problems setting the stackFiles to the behavior, though.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 835
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas

Re: Creating LiveCode applications that play well with git

Postby jim1001 » Sun Aug 13, 2017 12:14 am

Trevor,

Tried to move my project from local drive to a network as I saw you had updated Levure to allow use of network drives (didn’t realise it was so long since I checked!).

I had the local drive project open in LiveCode which I exited. I then copied the file structure onto the network drive. When I opened the project on the network drive I got lots of messages of form “A stack with the same name as the one you are trying to load is already open. Before loading <network drive stack> what do you want to do with <local drive stack>?”

  1. If I’ve exited LiveCode when the local drive stacks were open why are they still open when I close then start a fresh instance of LiveCode? They do have destroyStack set to false but shouldn’t they be removed from memory when LiveCode exits?
  2. To stop it happening in the future I’ve read on the forums that you can a) set destroyStack property to “true” for new stacks in Preferences and b) set destroyStack “true” for existing stacks. Would that create any problems with a Levure project?
  3. Even if I choose to purge the local stacks they are still reported as open the next time I open the network drive project. Is the answer to open the local project, set all stacks with destroyStack as true, close LiveCode then open it again on the network project?

I tried to replicate the problem with a simple one stack non-Levure project but couldn’t.

Thanks for help.
jim1001
 
Posts: 103
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Postby jim1001 » Sun Aug 13, 2017 12:19 am

One more for the road Trevor:

I’m not copying my media onto the Android device every time I install my application. I have the media already on the device and refer to the absolute path of a media file from code within my app. If I want to set an Assets / Media directory base location for use when running on Android (that will be a different location to the corresponding IDE directory) is the best / natural Levure way to put it in a preferences : shared : android file? I’m not sure if that’s a recommended use for preference files.

ps: I don’t quite understand how you’ve used preferences in the Bell Conductor app. In app.yml you set different values for preferences filename > user > default & windows. But you also have a prefs.yml set in the build profiles section. Please can you explain?

Many thanks,
Jim
jim1001
 
Posts: 103
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Postby trevordevore » Sun Aug 13, 2017 2:15 am

jim1001 wrote:I’m not copying my media onto the Android device every time I install my application. I have the media already on the device and refer to the absolute path of a media file from code within my app. If I want to set an Assets / Media directory base location for use when running on Android (that will be a different location to the corresponding IDE directory) is the best / natural Levure way to put it in a preferences : shared : android file? I’m not sure if that’s a recommended use for preference files.


`shared` preferences won't work on mobile devices. AFAIK there isn't a shared location for mobile devices. If there is then we would need to add the logic to the preferences helper.

While you could use preferences to store a path, I don't think I would Unless the path is going to be different on every Android device I would probably just write a function that returns a different value based on the environment.

Code: Select all
function MediaAssetFolder
  if the environment is "development" then
    # return IDE path
  else
    # return Android path
  end if
end MediaAssetFolder


jim1001 wrote:ps: I don’t quite understand how you’ve used preferences in the Bell Conductor app. In app.yml you set different values for preferences filename > user > default & windows. But you also have a prefs.yml set in the build profiles section. Please can you explain?


prefs.yml stores default values to use for preferences. See these docs:

https://github.com/trevordevore/levure/ ... ces-values
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 835
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas

Re: Creating LiveCode applications that play well with git

Postby jim1001 » Mon Aug 14, 2017 12:17 pm

I would probably just write a function that returns a different value based on the environment.


Thanks for the advice. That was an option I’d considered & good to know your thoughts.

I had looked at the preferences docs on the wiki before my first posting & have just looked at them again. As I understand it now:

  1. the developer sets default app preferences in prefs.yml. The user cannot read or write to these.
  2. if an app uses preferences then the developer can ask the user whether they want to share preferences for all users of the device (maybe on install?) This would determine whether in the app code preferences are stored to the shared or user preferences file
  3. the user can override the default prefs.yml preferences by setting values in the app. These user-set preferences are then stored in the file specified by the developer in app.yml > preferences filename > user / shared prefs file

Is that right?

Thanks.
jim1001
 
Posts: 103
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Postby jim1001 » Mon Aug 14, 2017 12:44 pm

When I opened the project on the network drive I got lots of messages of form “A stack with the same name as the one you are trying to load is already open.


Re: the above messages from one of my previous posts

I think (hope) I may have found the problem. I set a lot of behavior script files as stack files of the UI in the app.livecodescript file & use levureAppFolder() for the first part of the path to the behavior script files. However LiveCode hardcodes these paths in the UI .livecode file on saving. So even though I moved the project to a network drive Z: these files were trying to be loaded from the local C: drive on project startup.

When I saved the UI .livecode file after clicking through all the warning messages & clicking the “Open application” button for the Levure app the stack files were then hardcoded as Z:/… in the saved UI .livecode file on disk. The next time I opened the network drive project I didn’t get the “stack with the same name…” messages.

Hope that makes sense!
jim1001
 
Posts: 103
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Postby trevordevore » Fri Aug 18, 2017 4:56 am

Yes it does. I think if you try setting the stackFiles property by hand (rather than using the PI) then you can use relative paths to the behavior files without the IDE adding the full paths. In LC 9 the PI works properly. In LC 8 there are still some issues with relative paths. I just set the stackFiles by hand and it works for me and I don't have to worry about setting the stackFiles in my code.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 835
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas

Previous

Return to Talking LiveCode

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests