[TADS3] File Safety exception Question

Is there a way to find out the file safety setting of the interpreter at runtime? It would be nice to know so I can make my game not even try to open a file if it’s going to be blocked.

Currently, when a file safety exception is thrown, the game displays the error message and aborts execution. I would prefer the game to continue without opening the file. From what I can see from the code, it appears that once the exception is thrown the game leaves the command loop.

I even tried placing a catch for the exception in my code. The library appears to ignore it and throw the exception anyways.

1 Like

Is there a way to find out the file safety setting of the interpreter at runtime?

I don’t actually know for sure, but I suspect not. It doesn’t seem to be documented anywhere. Probably the smart thing to do is to design the game in such a way that it doesn’t need to access files outside of what’s allowed by the default safety level, and deal with errors appropriately. (It seems like “why isn’t this error caught?” is maybe the better question to investigate here.)

it’s never possible anyway to be completely sure that a file is readable until you read it. It’s not just a matter of filesystem permissions, which are very different on Windows than on Unixy systems; it may also be that there are multiple layers of security features restricting file access: in addition to the TADS 'terp’s safety setting, your read might get blocked by fundamental OS-level file permissions, or by SELinux context, or by networking protocols, or by antivirus software, or by … any of a fairly large variety of other things. (And if you’re interested in writing files, there’s a whole other set of potential problems.)

In any case, there’s no way to predict whether you can reliably read from a file even with all of the information above: if the file is stored on a failing disk, file permissions might not matter.


I’ve done that from the start. My game only works with files in the same location as the t3 file. I was just hoping I could make the game adjust. I believe the public game servers have file access disabled.

This is mainly for progress transfer in an episodic WIP I’ve been tossing around in my head. I might have to make a game code backup method.