ssokolow / saveswap

A simple tool for manipulating the endianness of save data dumped from Nintendo 64 cartridges
MIT License
20 stars 2 forks source link

Check for read-only input file before dying with an error #1

Open ssokolow opened 7 years ago

ssokolow commented 7 years ago

Saves copied off a cartridge via the Retrode will have their mode bits set to 444 (r--r--r--) on Linux.

This has the annoying side-effect that, if saveswap is run on them, you're likely to wind up with the following set of steps:

  1. Naively run saveswap on the file.
  2. It dies with an error.
  3. chmod the file writable
  4. Re-run saveswap.
  5. It dies because the previous run left a read-only backup file that it can't overwrite.

Saveswap should either detect this an exit before creating the backup or set the appropriate permissions for you. (I'll need to think about what would provide the best balance for use in scripts and non-scripted use.)