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] [Win on Wine] getFileExists() always returns zero for directories

Author
Message
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 03:42
both 2 last versions, 2018.12.12 and 2018.11.08, 32 and 64 bit, on Wine on Ubuntu 18.10, no matter if there is a trailing slash at the end

can somebody tell me if getFileExists() works for directories on Windows?
error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 16th Dec 2018 03:53 Edited at: 16th Dec 2018 04:04
It works for all the programs I have that use it on pc and android
If you dont set a path it will look in the media directory is that possibly the problem
otherwise you could set a raw path which will only work on windows. Alos if you dont
set a path it may look in the temp directory that agk uses for created files. The best solution
is just to place all folders in the media folder if you want to place folder inside the media
folder you could do this by setting the path to "media\folder" by using the command
and integer SetFolder( str ) is a way of setting a path to a folder for reading and
writing


integer GetFileExists( szFile )
Returns 1 if the given file is located in either the resource directory or the write directory assigned to the app.
https://www.appgamekit.com/documentation/Reference/File/GetFileExists.htm
The help file has a good example showing how this command works. You may note windows
is not case sensitive but Linux and Android is so if your file is called"FiLE.TXT" "file.txt" wont work
nor will "FiLE.txt" work and UBUNTU needs it to be perfect regardless of the fact your using WINE
fubar
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 04:45
yeah, right...

man, I'm not a newbie here. and I checked ALL the conditions before posting.

something around 16 KLoC project here. the code runs fine on Linux but I have no Windows machine to check it. so I tried Wine and there is something wrong with that on it.

after all isolating I've found getFileExists() broken. so I can write and read files but I cannot check if a directory exists or not.

now I see deleteFolder() does not work too. I can delete files inside a directory but I can't delete that directory itself even if it is already empty.
error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 16th Dec 2018 06:45 Edited at: 16th Dec 2018 07:15
Just tested the example in the help file posted on the link above
and it works perfectly well on both windows and android

So it may be a problem with using Windows on Wine in Ubuntu

I also tested deletefile() and deletefolder() and they both work for me
have you tried using SetFolder or SetCurrentDir
fubar
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 09:24
fubarpk wrote: "the example in the help file posted on the link above"

lol, there is even no check for a directory existence. but thank you anyway.

can you help me a bit more? download any Windows version of this (no need to pay anything, just enter zero $), let the lander crash at least once and check if the landing counter value will be loaded next time you run the game (you will need to let it crash again to find out).
error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 16th Dec 2018 09:35
I get the error windows cannot access the path or file from both 32 bit and 64 bit versions placed only an hour ago
fubar
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 16th Dec 2018 11:34
Both x64 and x32 windows, landing counter increments in game but resets upon new launch, I get no errors though the game runs fine.
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 12:35
fubarpk wrote: "I get the error windows cannot access the path or file"

damn. what is your setup? Windows version, maybe some restrictions, etc...

fubarpk wrote: "versions placed only an hour ago"

this is the first public release.

PartTimeCoder wrote: "I get no errors though the game runs fine"

thank you for testing!

I've run to my friend with Windows 7 machine ASAP and I've got the same behaviour like on Wine. the only difference is deleteFolder() does work.

but getFileExists() does not. please check out this no-brainer:

error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 12:45
of course I can workaround this for myself (my code is just checking if the folder exists before of loading atomic updates of configuration from that) but a command is not working as it should to. that's a fact it seems.
error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 16th Dec 2018 14:31
Quote: "please check out this no-brainer:"


all zeros

Here's a quick workaround



GetFileExists() makes no mention of directory checking so I dont think its a bug with the function and maybe more a case of lack of implementation, in PureBasic the same function returns -1 if the given variable is a directory, maybe ask Paul to adopt this system too.
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 16th Dec 2018 15:09
PartTimeCoder wrote: "no mention of directory checking"

oops, I haven't thought about it like that. just used to use it on Linux (and since there is no specific command for directories...)
error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: NOVGO!
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 19th Dec 2018 20:44
PartTimeCoder wrote: "Here's a quick workaround"


my workaround is not so quick but still:

error #1:
'too many stars, too many stares. disembody.'
Lone Star Dive: Fears of Mars

Login to post a reply

Server time is: 2024-03-28 09:06:50
Your offset time is: 2024-03-28 09:06:50