Prefs Stack Problems
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Prefs Stack Problems
Hi. I've run into a problem that's perplexing me.
I have a program that I wrote way back in LC (or was it still RR then?) 4.x. I've been maintaining it and updating it from time to time. With LC 7, something seems seriously broken with my preferences stack and I'm not figuring out how to fix it.
Basically, I have a substack called PrefsTemplate. My code checks for a stack in the user's preferences folder [Name of Program].rev. If this exists, I open it up when my program launches. If it doesn't, then I save a copy of the PrefsTemplate substack in the user's preferences folder.
There's nothing in this substack. I then use custom properties to save key/value pairs in the preferences stack. This has worked beautifully until just recently.
Now, in LC 7 (& 7.01-rc2), things work as expected in the IDE but not in stand =alones. In the standalones, the "open stack tPathToPrefsFile" is apparently not working and also does not generate an error.
I'm at a loss as to what to do to fix it. Do I need to somehow update my template stack in my main stack? Do I need to start using the .livecode file extension? What's the best way to determine if the "open stack" command worked or not?
Thanks in advance for any help.
I have a program that I wrote way back in LC (or was it still RR then?) 4.x. I've been maintaining it and updating it from time to time. With LC 7, something seems seriously broken with my preferences stack and I'm not figuring out how to fix it.
Basically, I have a substack called PrefsTemplate. My code checks for a stack in the user's preferences folder [Name of Program].rev. If this exists, I open it up when my program launches. If it doesn't, then I save a copy of the PrefsTemplate substack in the user's preferences folder.
There's nothing in this substack. I then use custom properties to save key/value pairs in the preferences stack. This has worked beautifully until just recently.
Now, in LC 7 (& 7.01-rc2), things work as expected in the IDE but not in stand =alones. In the standalones, the "open stack tPathToPrefsFile" is apparently not working and also does not generate an error.
I'm at a loss as to what to do to fix it. Do I need to somehow update my template stack in my main stack? Do I need to start using the .livecode file extension? What's the best way to determine if the "open stack" command worked or not?
Thanks in advance for any help.
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Prefs Stack Problems
When any error occurs it's helpful to check "the result" immediately after the failing statement to see if it provides guidance on how to correct the issue.
If an error involves file I/O, it's often helpful to also check the sysError function to see what the OS is trying to tell us.
So after your command that fails to open the stack, add this line:
...and report back here what you find.
If an error involves file I/O, it's often helpful to also check the sysError function to see what the OS is trying to tell us.
So after your command that fails to open the stack, add this line:
Code: Select all
put the result && sysError()
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Prefs Stack Problems
Hello again,
After a bit more troubleshooting, what I'm discovering is that my prefs stack might be a red herring. What I have determined now is that "revChangeWindowSize" is causing my openStack handler to exit before my prefs file gets opened. revChangedWindowSize is working as expected in the IDE but not in my standalones.
After a bit more troubleshooting, what I'm discovering is that my prefs stack might be a red herring. What I have determined now is that "revChangeWindowSize" is causing my openStack handler to exit before my prefs file gets opened. revChangedWindowSize is working as expected in the IDE but not in my standalones.
Re: Prefs Stack Problems
What appears to be (one of) the offending lines that works in the IDE but crashes in the standalone is this:
Of course, the itemDelimiter is set to the colon.
Works just fine in the IDE (tVolume becomes "Mac HD") produces the following error in the standalone:
Code: Select all
put item 1 of revMacFromUnixPath("/") into tVolume
Works just fine in the IDE (tVolume becomes "Mac HD") produces the following error in the standalone:
Any ideas?573,88,1,revMacFromUnixPath
Re: Prefs Stack Problems
Here's method that works fine in the IDE but exits at revMacFromUnixPath in a standalone:
What's really maddening is that I pasted this subroutine into a brand new stack, saved it as a standalone, and it works just fine. But, anywhere I call revMacFromUnixPath in my existing (and quite large and nearly 9 year old) stack it exits any method/subroutine that calls revMacFromUnixPath.
Anybody out there got any ideas?
Code: Select all
function getBootVolume
if "Win" is in platform() then
set itemDel to "/"
put item 1 of tempName() into tVolume
else
if "Mac" is in platform() then
set itemDel to "."
if item 1 of the systemVersion >= 10 then
-- Mac OS X
set itemDel to ":"
answer "We're about to go." --obviously this is for debugging only, removed from final build
put item 1 of revMacFromUnixPath("/Users") into tVolume
answer tVolume --also for debugging, never gets this far in the standalone
else
-- Mac OS 9 or earlier
set itemDel to "/"
put item 2 of tempName() into tVolume
end if
else
-- all other platforms
set itemDel to "/"
put item 1 of tempName() into tVolume
end if
end if
return tVolume
end getBootVolume
Anybody out there got any ideas?
Re: Prefs Stack Problems
Hi Tetsuo-san,
1. you can have the name of the bootvolume a bit easier by using:
...
put line 1 of the volumes into tBootVolume
...
2. 573,88,1,revMacFromUnixPath
That error means "Handler not found", so it sounds like you did not add all neccessary Rev libraries to your standalone.
Doublecheck this in the standalone builder settings!
Best
Klaus
1. you can have the name of the bootvolume a bit easier by using:
...
put line 1 of the volumes into tBootVolume
...
2. 573,88,1,revMacFromUnixPath
That error means "Handler not found", so it sounds like you did not add all neccessary Rev libraries to your standalone.
Doublecheck this in the standalone builder settings!
Best
Klaus
Re: Prefs Stack Problems
Klaus,
Thanks for the reply.
So, line one of volumes is always the boot volume? I wondered about that but didn't want to assume that it would always be the case.
Interestingly, I have not manually decided what to include or not include in my standalone. I've always just had "Search for required inclusions" checked and never bothered with "Select inclusions."
Since I don't want to have to manually decide what to include or not, is there any way to get the "Search for required inclusions" option working properly again with this stack?
Thanks again for your help.
Thanks for the reply.
So, line one of volumes is always the boot volume? I wondered about that but didn't want to assume that it would always be the case.
Interestingly, I have not manually decided what to include or not include in my standalone. I've always just had "Search for required inclusions" checked and never bothered with "Select inclusions."
Since I don't want to have to manually decide what to include or not, is there any way to get the "Search for required inclusions" option working properly again with this stack?
Thanks again for your help.
Re: Prefs Stack Problems
Update- choosing "Select inclusions" in the build settings is the only way for me to build a standalone that works properly from this stack now. Frustrating that the "Search for required inclusions" option no longer works for this stack.
Also, for some strange reason if I don't check "Font Support" then I end up with a standalone that errors out on revChangeWindowSize & revMacFromUnixPath. I find this particularly odd because I stumbled upon another forum thread where the question was asked about the revCommon library and why it would not get included. It seems that revCommon should always get included and it doesn't seem like there is a way to control whether or not it does. I suspect that there is a bug that is causing revCommon to not be included in standalones. And, why would revCommon be tied to or associated with "Font Support?"
Also, is there a good resource explaining how to decode those cryptic error messages?
Thanks again for the help provided so far- I doubt I would have ever figured out it had anything to do with build settings.
Also, for some strange reason if I don't check "Font Support" then I end up with a standalone that errors out on revChangeWindowSize & revMacFromUnixPath. I find this particularly odd because I stumbled upon another forum thread where the question was asked about the revCommon library and why it would not get included. It seems that revCommon should always get included and it doesn't seem like there is a way to control whether or not it does. I suspect that there is a bug that is causing revCommon to not be included in standalones. And, why would revCommon be tied to or associated with "Font Support?"
Also, is there a good resource explaining how to decode those cryptic error messages?
Thanks again for the help provided so far- I doubt I would have ever figured out it had anything to do with build settings.
Re: Prefs Stack Problems
I've started a new thread here:
http://forums.livecode.com/viewtopic.php?f=9&t=22215
so that people don't have to read everything that led to the discovery what appears to be the actual problem (and what I believe may be a bug in LC).
http://forums.livecode.com/viewtopic.php?f=9&t=22215
so that people don't have to read everything that led to the discovery what appears to be the actual problem (and what I believe may be a bug in LC).
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Prefs Stack Problems
Thanks for being mindful of thread relevance. I'll reply in the new thread.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Prefs Stack Problems
Replying here because it isn't related to the new thread. Go to the User Samples (in the tool bar in LiveCode) and search for "LiveCode Error Lookup". This plugin stack allows you to paste or type in the error codes and shows you what they mean. It uses the same lookups the IDE uses when it reports errors.Also, is there a good resource explaining how to decode those cryptic error messages?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Prefs Stack Problems
In addition to Jacque's good tip, you can also include an error handling dialog in a standalone - see the last tab in the Standalone Builder.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn