Game Development Community

XML paths problem saving out a file

by Andy Hawkins · in Technical Issues · 11/03/2012 (5:36 pm) · 3 replies

I've got an apache server running on my hard drive to set up //localhost in preparation to save high score and profiles on my website.

I'm trying to save to localhost but whenever I save out an XML file it appends this...
(CatPaw is the game name)
"C:\Users\Andy\AppData\Roaming\Independent\CatPaw"


and that's where it's found. I even tried this by adding escape slashes like this...
%txml = new ScriptObject() { class = "XML"; };
%fileFullname = "////localhost//playerProfile.xml";
if(%txml.beginWrite(%fileFullname))
 {
and it just ends up here...
C:\Users\Andy\AppData\Roaming\Independent\CatPaw\localhost

How do I strip out this information and save it on my local host?

#1
11/03/2012 (5:51 pm)
Just as an aside it took me ages to paste this code because the website doesn't seem to like tabs and slashes.
#2
11/04/2012 (10:39 am)
Hi Andy

Untested, Try:

$webServerAddress = "localhost";
$xmlFilePath = "/playerProfile.xml";

   %txml = new ScriptObject() { class = "XML"; }; 
   %txml.beginWrite($webServerAddress, $xmlFilePath, "" );
#3
11/04/2012 (10:46 am)
changed the code above to reflect your original code variables. I use mine on a web server, should work locally also.