notme21
notme21

Reputation: 47

Is there a way to set a file to read only in GODOT

I am saving data as part of a game, using a CSV file, and want to set it to read-only so that the user cannot modify it (system designed for not very experienced users).

Is there any way to save these files so that they are read-only?

Upvotes: 2

Views: 428

Answers (1)

rcorre
rcorre

Reputation: 7228

Unfortunately it seems that godot's File API does not provide a mechanism to change file permissions. You could try using an encrypted file, which will prevent the user from trivially viewing it as a CSV file (e.g. it shouldn't open by default in their spreadsheet program). However, an encrypted file can still be overwritten and corrupted, and this will hinder modding for players that enjoy digging around game files.

You could write a proposal to include permissions functionality in the File API, or write the saving code in a language other than GDScript, where you'd have access to a standard library with this functionality. You could write a GDNative extension that supports this.

Ultimately you have to decide how important it is to fool-proof your system. A determined user will find ways to break things.

Upvotes: 0

Related Questions