Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [Bug] OpenToRead() doesn't find file in debug mode

Author
Message
Ekkr
9
Years of Service
User Offline
Joined: 17th Apr 2015
Location:
Posted: 12th Feb 2017 23:40
Hello!

My game's config file initially doesn't exist in the game's fixed media folder.
When options are changed, it is created in the writable media folder, e.g. under Windows in /Users/.../AppData/Local/AGKApps/.../media
Next time the game runs, OpenToRead() correctly finds and reads/writes it.

But when I'm in debug mode, OpenToRead() doesn't find it.
Debug log tells me, that it couldn't find the file.
This seems to be a bug.

Kind regards,
Ekkr
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Feb 2017 23:46
Try manually deleting the /Users/.../AppData/Local/AGKApps/app-name directory
Ekkr
9
Years of Service
User Offline
Joined: 17th Apr 2015
Location:
Posted: 13th Feb 2017 00:20 Edited at: 13th Feb 2017 00:22
Hello blink0k,

why should I delete it?
The purpose of this folder is to be able to create and write files at run-time.
In debug mode OpenToRead() should behave as in non-debug mode: searching for the file in the writable media folder, first.

Regards,
Ekkr
Ekkr
9
Years of Service
User Offline
Joined: 17th Apr 2015
Location:
Posted: 13th Feb 2017 00:58 Edited at: 13th Feb 2017 01:01
Ok, this is weird:
When running my game in debug mode, AppGameKit creates a folder /Windows within /Users/.../AppData/Local/AGKApps/
And in /Windows it creates a folder named as my game
-> /Users/.../AppData/Local/AGKApps/Windows/MyGame

Then, AppGameKit copies all (!) files from the fixed media folder to this folder.
Because in my fixed media folder my config file doesn't exist, it also doens't exist in
/Users/.../AppData/Local/AGKApps/Windows/MyGame.

The debugger only seems to access folder /Users/.../AppData/Local/AGKApps/Windows/MyGame
instead of /Users/.../AppData/Local/AGKApps/MyGame.
And so, it doesn't find my config file.

Very strange. Who can give me an explanation for this behaviour?

Regards,
Ekkr
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Feb 2017 01:48
yes this happened to me. i don't know why but it seems to get to a point where it doesn't refresh the directory. that's why i suggested deleting it
Ekkr
9
Years of Service
User Offline
Joined: 17th Apr 2015
Location:
Posted: 13th Feb 2017 02:48
Ok, now I know, what you mean.
In debug mode, /Users/.../AppData/Local/AGKApps/MyGame is never used.
Instead, always /Users/.../AppData/Local/AGKApps/Windows/MyGame is used (beforehand created and updated with the whole stuff from the fixed media folder).
And this doesn't work correctly sometimes in your case.

Would be nice, if AppGameKit would explain, why they do this.
I didn't find any documentation about this :-(

Thanx,
Ekkr
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Feb 2017 03:08
i am not sure why they do it either. i have just learned to delete the folder when things go awry. a reboot might help as well
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 13th Feb 2017 16:00
This happens on OSX as well. Have not looked where debug mode stores the files but it does not find any files I have written in normal mode. Rerunning in normal mode finds the files again, so I guess it uses a different directory. Makes debugging hard sometimes.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 14th Feb 2017 23:03
When you use the Run button in the IDE it runs the exe located in your project folder which will use the path /Users/.../AppData/Local/AGKApps/MyGame, however when you debug the IDE starts running a copy of the AppGameKit Player on Windows (located in AGK\Tier 1\Compiler\interpreters\Windows.exe) which will use the path /Users/.../AppData/Local/AGKApps/Windows. The IDE then broadcasts your app to the player for debugging and the player creates the sub folder "MyGame" in its folder structure to store your files.

To work around this you could test locally by having a copy of the player running on your machine and broadcasting to it instead of using run, this would also place files in /Users/.../AppData/Local/AGKApps/Windows. Or you could try using GetWritePath and SetRawWritePath to check and correct the path.

Login to post a reply

Server time is: 2024-04-26 15:07:37
Your offset time is: 2024-04-26 15:07:37