WriteString - Save a string at runtime

Joined
Nov 26, 2017
Location
Frankfurt/Germany
Let's assume I want to store the actual date and time when the game is over in a logfile that I can later access manually. I'm doing the following, but it seems to not update the file at all:

(gamedata2 is defined as int-array, gamedata is defined as string)

'write game status to file
gamedata2=GetDate()
gamedata=" GameOver:"+gamedata2[2]+"/"+gamedata2[1]+"-"+gamedata2[3]+":"+gamedata2[4]
Local file:=FileStream.Open("cerberus://internal/usage.txt","a")
file.WriteString(gamedata,"utf8")
file.Close
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
I will try tonight or tommorow. Some questions:

Which target platform and OS?
Was the file initially created and is already there, so you just want to update it?
 
Joined
Nov 26, 2017
Location
Frankfurt/Germany
It's Mac OS X 10.9.5.
Yes, the file is already there and should be updated. With each game played, it should write the start-time and end-time to the file, so I can later see how many games have been played and how long they lasted.
 
Joined
Nov 26, 2017
Location
Frankfurt/Germany
Hm, so it must be the file or the location of the file. Mine is:

computer.buildv2018-04-22/glfw3/xcode/internal/usage.txt

(computer is the cerberus file name)

It still doesn't do anything on my system. What can it be?
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
Are you sure it doesn't update? Your code adds the same value in a row. Is that location of your code even called?
Where on your mac is the app stored?

There is a file example in the examples/mojo/mak folder, you can modify it and will see that it works.
 
Joined
Nov 26, 2017
Location
Frankfurt/Germany
- Yes, I'm sure it is called, since it's at the start of the game AND at the end of the game.

- The file usage.txt is still the same at the end, modification date didn't change and the content is only what has been there before, which is just "Usage "

- Maybe I should upload to dropbox and let you take a look. I'm really clueless here.
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
Ok, I have seen your screenshot and you are looking into the initial folder of your project. You need to look into the internal folder inside your app resources.
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
@yodasvideoarcade Seriously, dawlane has showed you where to look for regarding Apple app bundles. OSX is not Windows nor Linux.
Windows 10 handles files and folders where you can store stuff differently than XP.
If you are not willing to familiarize yourself with the development platform you want to release your apps on, you won't get very far.
CX is definitely not a tool for someone who wants just to press a button and voila, the app gets uploaded into the appstore.

Do you find at least the .app file that was created from Xcode? Or are you unable to locate that too?
If you found it, this is the app bundle. Right click on that file and select Show content.
There inside the resources folder and its children, you find what you are looking for.
 
Joined
Nov 26, 2017
Location
Frankfurt/Germany
I don't use Windows or Linux, no idea about how it works there. I just used Blitzmax, Monkey, and now Cerberus, all on Mac. I don't need to release the apps, nor upload to the app store. They just need to run on HTML5 and on my computer (or the one I copy it to). Please try some of my games at yodasvideoarcade.com and tell me they're not fun to play. ;-)

Yes, now I found it. In appname.buildv2018-04-22/glfw3/xcode/build/release/

How could I have known that the actual app I click on to run it is called an app-bundle? And also, how could I know that right-clicking on it shows a folder with contents?

But anyway, now I know. I appreciate the explaination. That's exactly what I needed. If you ever come to Frankfurt, let me know so you can be my guest to play one of my Escape Rooms.
 
Top Bottom