D
dannyjenn
Guest
I believe this is a bug, but before I go filing the bug report I figured I'd ask here to make sure it's just not me misunderstanding how the sandboxing works.
So the problem is this:
I am writing some code to load data from a bin file and also to save data to a bin file.
I have my load code:
And I have my save code:
The saving code works fine, exactly as expected.
The loading code works, but only when the file that the user chooses is either:
1.) a file in the working_directory, or
2.) a new file (even if outside the working_directory) which the user made through my game's save feature, this session
The loading code does not work when the player chooses any other file. I get no error message or anything, but my byte variable always loads as 0, even when the first byte in the chosen file is not $00.
My only guess is that this has something to do with the sandboxing. But I thought that get_open_filename() was supposed to bypass the sandboxing? That's why I am thinking that this is a bug and not anything I'm doing wrong. (I am on a Mac, by the way.)
So the problem is this:
I am writing some code to load data from a bin file and also to save data to a bin file.
I have my load code:
Code:
var path = get_open_filename( . . . );
if(path==""){
show_message("!");
exit;
}
var file = file_bin_open(path, 0);
var byte = file_bin_read_byte(file);
file_bin_close(file);
Code:
var path = get_save_filename( . . . );
if(path==""){
show_message("!");
exit;
}
var file = file_bin_open(path, 1);
file_bin_write_byte(file, $FF);
file_bin_close(file);
The loading code works, but only when the file that the user chooses is either:
1.) a file in the working_directory, or
2.) a new file (even if outside the working_directory) which the user made through my game's save feature, this session
The loading code does not work when the player chooses any other file. I get no error message or anything, but my byte variable always loads as 0, even when the first byte in the chosen file is not $00.
My only guess is that this has something to do with the sandboxing. But I thought that get_open_filename() was supposed to bypass the sandboxing? That's why I am thinking that this is a bug and not anything I'm doing wrong. (I am on a Mac, by the way.)