• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Mac OSX Possible bug regarding the sandboxing

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:
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);
And I have my save code:
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 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.)
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I'd suggest to try with buffer_ functions instead - I recall that something had been broken about file_bin_ functions but we didn't pinpoint it out on the project because we were migrating to buffers anyway.
 
I have the same problem on the Mac using get_open_filename() to try to load pre-existing sprites from outside of the sandbox. Interesting that you can load files that the user created during the session.

I believe its a bug.

See links below for the forum post and bug report.

Forum Post

Bug Report
 
Top