New PlatformInfo Parameter

Previous topic - Next topic

fjsantosb

Hi all.

I was waiting impaciently for the new command Parameter of PlatformInfo 'Document', which have the ability to save files on iPhone (I need mainly to save some settings).
Its seems to work pretty well (Althought i haven't tested on real device yet, it works wells on glbasic).
But i discover while i was playing around that files creates using openfile command (and write command), beggins always with '0', ie. i have created a data file name settings.dat and glbasic creates 0settings.dat file.
I don't care so much about it, but i am a little worry if that behaviour will be change in a future (creating settings.dat without extra character), because the applications done before the change can be crash (well i can code to find new file, but player will lose his game, settings, progress etc).

Best Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

codegit

#1
Hi

I have tested on PC and iTouch and I dont seem to be having any problem. Here is what I did to save a high score file:

Code (glbasic) Select


FILE_PATH$ = PLATFORMINFO$("DOCUMENTS")
.
.
.

ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 1)
IF (ok)
READLONG 1, highscore%
ENDIF

.
.
.
SUB GLB_ON_QUIT:
ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 0)
IF (ok)
WRITELONG 1,highscore%
CLOSEFILE 1
ENDIF

ENDSUB
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

fjsantosb

Yep its seems to work pretty well, the problem is the name of the file, anyfile i can save always is saved with character '0' ie. i save 'settings.dat', and in my hd is saved '0settings.dat'.

Best regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Hemlos

Hi,

Sounds like a bug with openfile..

Does this fix it the name?

Code (glbasic) Select
COPYFILE a$, "newname.bak"
Bing ChatGpt is pretty smart :O

fjsantosb

Mmmm, I tried your solution Hemlos, but doesn't work cause the problems seems to be the value of variable path.
if you write


GLOBAL path = PLATFORMINFO$("DOCUMENTS");
PRINT path, 0, 0;


You get 0, as value of variable path.

Strange...
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Hemlos

#5
Well to use info$ = PLATFORMINFO$(what$) you need to have this format as a string.

Second, platform info is simply a variable reader for your devices.

The openfile command is used for making/ saving files....if it isnt doing exactly what you want with the name...then its likely a bug...if you want i can move this thread into the bug report section.


Bing ChatGpt is pretty smart :O

fjsantosb

You are right Hemlos, my problem was that i haven't format variable as string (i am used to use string before variable name on c#).
So is not a bug, its my mistake!

All is working perfect!

So sorry!  :-[
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Hemlos

NP, glad i could help!  :)
Bing ChatGpt is pretty smart :O