GLBasic forum

Main forum => Bug Reports => Topic started by: Hemlos on 2009-Aug-02

Title: DOESFILEEXIST()
Post by: Hemlos on 2009-Aug-02
Code (glbasic) Select
ok=DOESFILEEXIST(FileName$)
PRINT ok,10,10
SHOWSCREEN
MOUSEWAIT


if my FileName$ is Particle.png then it will return 1

if the FileName$ is Particle2.png then it will return 0

Both files are properly named, and exist in the correct directory.

It seems the problem is: when a number is in the filename, it wont find the file.

Title: Re: DOESFILEEXIST()
Post by: Ian Price on 2009-Aug-02
Sorry, but it does work (in V6.248 anyway) - my Balloonacy game uses numbers in the data files for loading.

My exact (and working code)
Code (glbasic) Select

FUNCTION load_data:
LOCAL file$="media/data/b"+lvl+".dat"

LOCAL ok=DOESFILEEXIST(file$)

LOCAL n%

IF ok

OPENFILE (1,file$,TRUE)

FOR y=0 TO 23
FOR x=0 TO 39
  READBYTE 1, n
  map[x][y]=n
NEXT
NEXT

CLOSEFILE 1

ENDIF
ENDFUNCTION


It certainly works with data, not checked with images.
Title: Re: DOESFILEEXIST()
Post by: MrTAToad on 2009-Aug-02
Dont forget all images need to be in the .app directory (or at least in a directory from that)

It does works fine with images - with and without numbers in them :)
Title: Re: DOESFILEEXIST()
Post by: Hemlos on 2009-Aug-03
Sorry, in Version 7.057
The SpriteZ API error checking mode made me aware of it.

I researched all possible ways to cause this error....everything is named, placed, and declared perfectly.
So, I made a test program(top of this topic), and tested it a dozen times.
I found that, if a number is in the filename(in middle, or at the end, or anywhere in the name)...
...it returns zero.  :x
Title: Re: DOESFILEEXIST()
Post by: Moru on 2009-Aug-03
You might want to upgrade to the latest version before testing bugs: 7.061
I tested your code and it works perfectly on my computer.
Title: Re: DOESFILEEXIST()
Post by: MrTAToad on 2009-Aug-03
Are you running this on a Windows machine (case-insensitive filenames) or Mac/Linux (case-sensitive) ?
Title: Re: DOESFILEEXIST()
Post by: Hemlos on 2009-Aug-03
Quote from: MrTAToad on 2009-Aug-02
Dont forget all images need to be in the .app directory (or at least in a directory from that)

It does works fine with images - with and without numbers in them :)


sigh....yup this is it....i am not used to this extra directory.
I have 2 data directories lol.

Thank you all, for the help fellas, i was overlooking this, over and over again. :S
Title: Re: DOESFILEEXIST()
Post by: MrTAToad on 2009-Aug-04
We've all done that  :good: