Menu

#1714 Exult and ES crash when saving to a read only file or folder

Exult Studio
closed-wont-fix
nobody
None
5
2024-04-09
2010-12-29
No

Exult and ES crash when saving to a read only file or folder. This has been tested in Windows XP and Ubuntu. I think Windows Vista and 7 have a virtual reroute so this doesn't likely occur (may only be program files folder though).

The engines should probably test at startup and give a message (in game and in output) about not having write permission to the folder. The file path could be deleted from the cfg and the program could try the default home path. If that won't work, Exult could say so and exit. I think files inside the writable folders need to be checked since someone could have made a file read only by mistake or stupidity.

Here's an example of gamedat. (error description success?)

Creating 'gamedat' files.

An exception occured:
Error opening file /home/malignantmanor/.exult/blackgate/gamedat/npc.dat
errno: 2
Error Description: Success
============================

Exult Saving to a read only game save:

============================
An exception occured:
Error writing to file <SAVEGAME>/exult00bg.sav
errno: 0
============================

Exult Studio saving to read only patch:

terminate called after throwing an instance of 'file_open_exception'
what(): Error opening file /home/malignantmanor/Desktop/u7/patch/bodies.txt
Aborted

Discussion

  • Marzo Sette Torres Junior

    Detecting whether or not you have write permission is not trivial, especially in Windows. They straightforward way (simply trying to write the file) may cause compatibility shims to engage and redirect the writes elsewhere, so you are none the wiser. And trying to use the Windows API to decide whether or not you can do it is hard due to the need to use ACL API, which is non-trivial -- and does not play nice with MinGW.

     
  • Dominik Reichardt

    • Group: --> Exult Studio
     
  • Dominik Reichardt

    • status: open --> closed-wont-fix