Windows Error with filenames

A

AnotherDoor

Guest
Error! not allowing save with filename 'E:\Documents\Gamemaker\Kauppa2D_2.gmx\datafiles\default.txt'


Code that causes the error:

var file1;
file1 = file_text_open_read("E:\Documents\Gamemaker\Kauppa2D_2.gmx\datafiles\default.txt");


--------------------------------------------------------------------------------------------------------------------------------------
same with

Error! not allowing save with filename 'E:\Documents\Gamemaker\Kauppa2D_2.gmx\datafiles\save.txt'
Error! not allowing save with filename ''

var file;
file = file_text_open_write("E:\Documents\Gamemaker\Kauppa2D_2.gmx\datafiles\save.txt");
file_text_write_string(file,mapsave);
file_text_close(file);

- All the variables work, but the problem seems to be the filename.
- Both of the files already exist + I tried to delete them and run the code with same results. (+ no files were generated)
- I have both of the files in the "included files" thing, and they are both readable from there.
- "Kauppa2D_2" is the project name.
- Both of the codes are copied from GMS wiki
 
L

Laurent57

Guest
Why do you have a '.gmx' extension after Kauppa2D_2 ?

Kauppa2D_2.gmx seems to be a file not a directory.
 
Last edited by a moderator:

Llama_Code

Member
Well that's not a Wiki, thats the manual.

What you should have gotten from that link is that you can't use that function because Studio is sandboxed.

The only functions that will allow you to access directories outside the sandbox are

get_open_filename
get_save_filename

file_text_open_read will only open a file in the game bundle or save area.

If it is an included file, you should be using working_directory to access it.
 
A

AnotherDoor

Guest
Well that's not a Wiki, thats the manual.

What you should have gotten from that link is that you can't use that function because Studio is sandboxed.

The only functions that will allow you to access directories outside the sandbox are

get_open_filename
get_save_filename

file_text_open_read will only open a file in the game bundle or save area.

If it is an included file, you should be using working_directory to access it.
Okay, now it makes more sense. I was just confused because of the manual contained "inaccurate" information. Now that I think, it makes sense why it works that way.
 
Top