[0.13.1] Can't save to readonly save
[0.13.1] Can't save to readonly save
The game is unable to save to readonly saves.
I discovered this after I downloaded a save from the forum.
When I removed the readonly flag from the file I was able to save again.
You will probably have to combine these stackoverflow answers:
http://stackoverflow.com/questions/1255 ... ess-on-nix
http://stackoverflow.com/questions/7913 ... a-file-mfc
Into something like this:
if (!access(name, W_OK)) {
SetFileAttributes(name, GetFileAttributes(name) & ~FILE_ATTRIBUTE_READONLY);
}
I discovered this after I downloaded a save from the forum.
When I removed the readonly flag from the file I was able to save again.
You will probably have to combine these stackoverflow answers:
http://stackoverflow.com/questions/1255 ... ess-on-nix
http://stackoverflow.com/questions/7913 ... a-file-mfc
Into something like this:
if (!access(name, W_OK)) {
SetFileAttributes(name, GetFileAttributes(name) & ~FILE_ATTRIBUTE_READONLY);
}
-
- Burner Inserter
- Posts: 8
- Joined: Thu Jun 30, 2016 4:56 pm
- Contact:
Re: [0.13.1] Can't save to readonly save
Isn't that what read-only is supposed to do?
Re: [0.13.1] Can't save to readonly save
It is, except when it is unintended, like when I download a save and want to continue with it.
Re: [0.13.1] Can't save to readonly save
Well, it's not factorio that sets that flag. And file access control isn't performed by the game as well.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: [0.13.1] Can't save to readonly save
I am a bit lost, if you expect to be able to save to a file or directory that is read only, then your expectations are the problem. Or am I misunderstanding you?
Re: [0.13.1] Can't save to readonly save
Can't reproduce.
Re: [0.13.1] Can't save to readonly save
My expectation is that I can download a savegame, place it in the saves map and can continue playing with it.
Currently that isn't possible because Factorio doesn't take control of the file which gives errors like this:
Currently that isn't possible because Factorio doesn't take control of the file which gives errors like this:
- Attachments
-
- factorio-current.log
- (2.42 KiB) Downloaded 87 times
-
- Burner Inserter
- Posts: 8
- Joined: Thu Jun 30, 2016 4:56 pm
- Contact:
Re: [0.13.1] Can't save to readonly save
So your expectation is that the game overrides the OS's restriction on files that have been set read-only? ... (and by from what you've said so far are locked down due to ownership-lockdown, also an OS feature to protect you as a user ...)
Re: [0.13.1] Can't save to readonly save
It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.
But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
Re: [0.13.1] Can't save to readonly save
The problem here is that your file is marked as read-only. That does NOT happen by just placing a downloaded file in the folder.
Maybe right click the factorio folder in appdata and apply read-only off for all subfolders just to be sure.
Maybe right click the factorio folder in appdata and apply read-only off for all subfolders just to be sure.
Re: [0.13.1] Can't save to readonly save
I download save files *allllll the time* to look at peoples saves from bug reports and never once have had this issue.
It sounds like you've got some permissions issue wrong on your computer or maybe an antivirus software is changing downloads to read-only.
It sounds like you've got some permissions issue wrong on your computer or maybe an antivirus software is changing downloads to read-only.
If you want to get ahold of me I'm almost always on Discord.
- y.petremann
- Filter Inserter
- Posts: 407
- Joined: Mon Mar 17, 2014 4:24 pm
- Contact:
Re: [0.13.1] Can't save to readonly save
For my case I think that the game is doing right, a readonly file shouldn't be overwritable that easy, I think that a user error and to show that, I think that you should put a message directed toward the player about his file being readonly and having him to set write permissions manually or saving to another name.
Re: [0.13.1] Can't save to readonly save
If you refuse to solve this issue at least make the message readable for the average user.
And preferably with some explanation to the user how to remove the readonly permission.
And preferably with some explanation to the user how to remove the readonly permission.
Re: [0.13.1] Can't save to readonly save
read only does not mean a save file cannot be read so it isn't any exploit or whatever.Killerbee wrote:It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.
Word also cannot edit a read only file. The read only mark can ONLY be changed by the OS. Nothing else. What Word offers you is to create a copy but it cannot edit a read only file.Killerbee wrote:But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
Re: [0.13.1] Can't save to readonly save
You obviously didn't understand my exploit comment.Tychon wrote:read only does not mean a save file cannot be read so it isn't any exploit or whatever.Killerbee wrote:It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.
Word also cannot edit a read only file. The read only mark can ONLY be changed by the OS. Nothing else. What Word offers you is to create a copy but it cannot edit a read only file.Killerbee wrote:But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
Someone said it is part of a protection of the OS, which isn't the case.
When the save is corrupted, for example a string says it's 700 characters long while it in reality is only 30 characters long a badly programmed program will still try to read those missing 670 characters.
This can be used to crash programs, execute abitrary code etc.
The game will load the save regardless of the readonly flag, so when something like that is in the save and the savegame loading code is bad it will offer no protection.
Your comment about only the OS can change the flag isn't true as you could have seen in my first comment.
I've also tested in same code it wrote myself and I can easily remove the readonly flag without admin rights.
Just checked it in word, and it appears I was wrong, it doesn't change the readonly flag, but at least it gives a clean error.