mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 01:49:59 -04:00
Do not take a read-only ocarina.exe for a running game.
The launcher tells a running game by ocarina.exe refusing to open for writing, and a read-only exe (restored from a backup or copied from read-only media) refuses too: Rebuild, Update, Import Saves and uninstalling with the game were refused with "close the game" for good. The check now clears the read-only attribute of the build's own exe, which the next link replaces anyway, and tries again. Import Saves uses the same check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1216,6 +1216,15 @@ class SavesTest(unittest.TestCase):
|
||||
self.assertEqual((acct / 'save.dat').read_bytes(), b'older')
|
||||
self.assertFalse((tx / 'import').exists())
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'the running check is Windows only')
|
||||
def test_a_read_only_exe_is_not_a_running_game(self):
|
||||
exe = self.game / 'ocarina.exe'
|
||||
exe.write_bytes(b'MZ')
|
||||
os.chmod(exe, stat.S_IREAD)
|
||||
self.assertFalse(build.game_running(self.game))
|
||||
self.assertFalse(saves.game_running(self.game))
|
||||
self.assertTrue(os.access(exe, os.W_OK))
|
||||
|
||||
def test_read_only_files_import_writable(self):
|
||||
acct = saves.account_dir(self.game)
|
||||
self.files(acct, {'save.dat': b'old'})
|
||||
|
||||
Reference in New Issue
Block a user