SettingXML not working as of 0.991b2425

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
Voltstorm
GamingTools Subscriber
Posts: 11
Joined: Wed Jun 22, 2005 3:18 pm

SettingXML not working as of 0.991b2425

Post by Voltstorm » Sun Aug 21, 2005 8:56 am

Code: Select all

function main()
{
	declare sSettingFile string script "/Scripts/Upop_Settings.xml"
	Echo "${sSettingFile}"
	declare sName string script ${SettingXML[${sSettingFile}].Set[Other].GetString[Name,"NONAME"]}
	Echo "${sName}"
}
XML in /scripts folder:

Code: Select all

`<?xml version='1.0'?>
<InnerSpaceSettings NextID="2">
	<Set ID="1" Name="Other">
		<Setting Name="Name">Ertkrek</Setting>
	</Set>
</InnerSpaceSettings>
There are also unexplained CTD when running the same iss more than once. Does not always happen. The above code is placed in /scripts/main.iss and it crashes when "run main" is executed in console more than once.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sun Aug 21, 2005 11:10 am

You use a scripts folder in the root directory of your hard drive? e.g. C:\Scripts\ ? If not, then I suggest not having that leading / on the filename... Oddly enough, that gets past the absolute path detection in 2425, BUT WILL NOT WORK IN THE NEXT BUILD, just as it should not.

My test with build 2425 (please just use the build number, dont include 0.991b, that's just confusing ;) ) :

Code: Select all

function main&#40;&#41;
&#123;
   declare sSettingFile string script "Scripts/Upop_Settings.xml"
   Echo "$&#123;sSettingFile&#125;"
   declare sName string script $&#123;SettingXML[$&#123;sSettingFile&#125;].Set[Other].GetString[Name,"NONAME"]&#125;
   Echo "$&#123;sName&#125;"
&#125; 
ran fine first time, so I set the setting to Jimbob, saved the file, and ran it some more. ran it about 42 times. no crashes, nothing out of the ordinary... exact output I would expect.

Code: Select all

Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
Scripts/Upop_Settings.xml
Jimbob
ad infinitum

The only other problem I see is the ` before your <?xml ... but I assume that was a copy and paste error and does not really appear in the xml. Or does it?

Testing with the ` in the XML, it a) Fails to load, and b) Crashes on the second run.

Fix the XML, and dont use absolute paths when you mean to use relative paths!

Voltstorm
GamingTools Subscriber
Posts: 11
Joined: Wed Jun 22, 2005 3:18 pm

Post by Voltstorm » Sun Aug 21, 2005 11:25 am

This structure has worked fine for months ...

My install is c:\InnerSpace
the XML file is in c:\InnerSpace\Scripts
the script file is in c:\InnerSpace\Scripts

and even if I remove the leading / it still returns NULL and CTD on second attempt.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sun Aug 21, 2005 11:31 am

I'm sure it has worked for months, but the point is that it shouldnt work because of how file systems work. If you use a leading slash, you are implying an absolute path, and it should only be looking in the root directory.
and even if I remove the leading / it still returns NULL and CTD on second attempt.
That's because you didnt read second half of my post

Voltstorm
GamingTools Subscriber
Posts: 11
Joined: Wed Jun 22, 2005 3:18 pm

Post by Voltstorm » Sun Aug 21, 2005 11:31 am

even if I hardwire the structure it returns NULL and CTD on second call.

Code: Select all

function main&#40;&#41;
&#123;
	declare sSettingFile string script "C&#58;/InnerSpace/Scripts/Upop_Settings.xml"
	Echo "$&#123;sSettingFile&#125;"
	declare sName string script $&#123;SettingXML[$&#123;sSettingFile&#125;].Set[Other].GetString[Name,"NONAME"]&#125;
	Echo "$&#123;sName&#125;"
&#125;

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sun Aug 21, 2005 11:33 am

Please stop doing anything until you fix the XML as explained in the second half of my post.

Voltstorm
GamingTools Subscriber
Posts: 11
Joined: Wed Jun 22, 2005 3:18 pm

Post by Voltstorm » Sun Aug 21, 2005 11:36 am

Clearly there is an issue someplace ...

Code: Select all

function main&#40;&#41;
&#123;
	declare sSettingFile string script "C&#58;\\InnerSpace\\Scripts\\Upop_Settings.xml"
	Echo "$&#123;sSettingFile&#125;"
	declare sName string script $&#123;SettingXML[$&#123;sSettingFile&#125;].Set[Other].GetString[Name,"NONAME"]&#125;
	Echo "$&#123;sName&#125;"
&#125;
Should result in ...

Code: Select all

C&#58;\InnerSpace\Scripts\Upop_Settings.xml
<name>
But results in ...

Code: Select all

C&#58;InnerSpaceScriptsUpop_Settings.xml
NONAME

Voltstorm
GamingTools Subscriber
Posts: 11
Joined: Wed Jun 22, 2005 3:18 pm

Post by Voltstorm » Sun Aug 21, 2005 11:38 am

hose me down and call me an ass, PLEASE!

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Sun Aug 21, 2005 11:40 am

It shouldnt result in C:\Innerspace\etc because of escaping, but if you change it to ${sSettingFile.Escape} it outputs correctly ;)

Anyhow, the issue you experienced should not CRASH but should fail to load (with an error), and I am fixing that. But at least I got you to stop crashing finally ;)

Post Reply