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 Studio Chat / GetFileExists() not always seeing an existing file

Author
Message
frosty45
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location:
Posted: 5th Apr 2020 23:22
I'm having an issue with the reading of text files created by my app. GetFileExists is failing to see txt files saved in the Local-AGKApps-appname-media folder. I've made an app where I required people to be online and some requested an offline version. So I'm saving everything they do in a text file to be uploaded when they're online next. My app created the offlineLog.txt file in the media folder like it was supposed to. So I closed it, then put it in online mode and was going to test my uploadSessions() function but it never triggered. In debug, it skips right past the below as I'm guessing GetFileExists is returning 0 even though the file is there. Yes, the file names match and yes offline is = 0 during debug. I copied the name straight from the file to my code just in case. I also tried making a new txt file called "ab.txt" and changing the below if statement to look for it instead and it still failed. I then changed it to an older file and GetFileExists passed and continued to my function. I was having this issue earlier too where it wasn't seeing txt files so I deleted them all and remade them a couple times and it finally started working. Can anyone please illustrate what the issue may be? The app will be creating the text files itself, they'll not be anything I pre-package so they need to work.

frosty45
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location:
Posted: 6th Apr 2020 00:39 Edited at: 6th Apr 2020 06:55
Ok, using message(GetWritePath()), I see that when I run the program normally, it's checking the correct folder local/agkapps/appname. However, in Debug mode, it's looking at local/agkapps/windows/appname. Should I report this as a bug or is it intended? If so, it's pretty frustrating and has wasted a lot of my time today.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Apr 2020 00:40
from the code supplied I cant see anywhere you have used commands which may have affected the current directory
but it could be that getfileexists() is looking in the media folder and not checking the default save and load locations
you could try commands as a test to see if setting the current directory still has the same issue

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Apr 2020 00:43
your too quick for me lol you could try to make use of GetFolder () and SetFolder ()

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
frosty45
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location:
Posted: 6th Apr 2020 00:44
I just edited my 2nd comment with what I found was going on.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th Apr 2020 00:49
you could not so sure its a bug as such TGC might use the debug differently for a reason not sure
but there should be a work around with the available commandset. Personally I just would chose not
to use debug

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 6th Apr 2020 01:37 Edited at: 6th Apr 2020 01:38
The debug write path is different from the non-debug write path.
This is not a bug per se, but can be frustrating.

Login to post a reply

Server time is: 2024-04-20 03:18:32
Your offset time is: 2024-04-20 03:18:32