SOLVED Check if a file in a specific directory exists to change the sprite of an object

So I've tried to make the sprite of an object differ whether a file called "trueColor.ini", located in a folder called "PEEKINbios" that is located in the "C:" drive, exists. In the Create event I have two variables which are set to "scene = spr_Scene00" and "escene = spr_eScene00" respectively.

I tried to enter this code in the Step event: if file_exists("C:\\PEEKINbios\\trueColor.ini") sprite_index = scene; else sprite_index = escene;, but all it does is load the escene image variable, and I got this in the Output: "Error! not allowing file operation with filename 'C:\PEEKINbios\trueColor.ini'.".

I looked up some solutions to my problem here and there, but none of which could solve my problem. I am using GameMaker Studio 2 in case you're wondering, so if it doesn't work here, any alternatives that could work are welcome.
 
Last edited:

kburkhart84

Firehammer Games
I bet you are running into the sandbox. Look up the manual about that. I understand they now let you turn the sandbox off so you should be able to get around it easily enough.
 
I bet you are running into the sandbox. Look up the manual about that. I understand they now let you turn the sandbox off so you should be able to get around it easily enough.
Thanks for this information, since I know very little about the sandbox. Will let you know if it does work.
 
So for some reason on my version of GMS2, you can disable the "file system sandbox" on macOS and Ubuntu, but not Windows. I am aware of some of these extensions that could help that, but I haven't considered downloading any of them yet (and my original problem requires a quick and easy solution).
 

kburkhart84

Firehammer Games
I'm guessing you just need to scroll down to the setting. On mine, the settings was just off the dialog for those settings on the windows group, but not on the MAC settings because there are less of them. It works fine for me once I scroll down to it.
 
I'm guessing you just need to scroll down to the setting. On mine, the settings was just off the dialog for those settings on the windows group, but not on the MAC settings because there are less of them. It works fine for me once I scroll down to it.
Oh, I see it now. Thanks.
 
Top