Legacy GM [Solved] file_find_first issues

W

whale_cancer

Guest
I am having issues getting file_find_first to work properly. What I am trying to do is get a list of all folders in a directory; said directory holds folders which contain files related to map information (i.e. each folder contains everything a map needs to load).

However, I cannot even get it to find the first file! Argh, file handling was so much easier in GM8.

Anyway, here is the code I am using to find the first file, I am sure this is just some stupid little thing I am doing wrong:

Code:
tS = file_find_first('\Maps\*', fa_directory);
show_message(tS + ' loaded');
Right now, it only ever returns a blank string as tS. The Maps directory exists (it is created by my save function elsewhere) and contains three folders: 'default', 'default2', and 'default3'

Any help appreciated.
 

Stubbjax

Member
I think you may be missing one of the below read-only variables from the start of your directory. I think GM8 automatically uses the working directory when you find files, whereas GM Studio probably looks elsewhere first.

working_directory
program_directory
temp_directory
 
E

eltantillo

Guest
working_directory will return two different locations depending on what you are trying to do with a file. If you are writing it will return the "%LOCALAPPDATA%/gamedir/" and while reading can be either the local storage or the area where the included files are stored
 
W

whale_cancer

Guest
Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

Yeah, I did so much file handling stuff in GM8 (just making tools to help me mod games) and file handling was so much easier then.

See, I didn't try to use working_directory because when I used an absolute path to load things last time (by saving that path in an .ini) it didn't work (even though it pointed to the working_directory).

Now that I use working_directory again, it somehow finds the folders as it should, but I didn't think I could even do that due to my last use of an absolute path.

Thanks folks! But I must say file handling in GMS is a huge let down.
 
E

eltantillo

Guest
Thanks folks! But I must say file handling in GMS is a huge let down.
Yeah it changed a lot to make it compatible around all those platforms, not all OS allow you to access everywhere you want in the drive.
 
Top