Commit 0c1b83e
committed
Untested fix for renaming projects under wine
When renaming a newly created project under wine, this stack trace would
greet you:
Traceback (most recent call last):
File "bash\basher\__init__.py", line 2208, in OnLabelEdited
self.data_store.rename_info(package, name_new))
File "bash\bosh\__init__.py", line 1129, in rename_info
return self._rename_operation(oldName, newName)
File "bash\bosh\bain.py", line 1678, in _rename_operation
return self[oldName].renameInstaller(newName, self)
File "bash\bosh\bain.py", line 1532, in renameInstaller
return self._installer_rename(data, name_new)
File "bash\bosh\bain.py", line 982, in _installer_rename
del data[g_path]
File "bash\bolt.py", line 1254, in __delitem__
del self.data[key]
KeyError: bolt.Path(u'test')
Upon restarting, things would become even worse, with the entire
Installers tab whited out. A different stack trace occured:
Traceback (most recent call last):
File "bash\basher\__init__.py", line 3553, in OnShowPage
self.currentPage.ShowPanel()
File "bash\balt.py", line 1796, in _conversation_wrapper
return func(*args, **kwargs)
File "bash\basher\__init__.py", line 2898, in ShowPanel
scan_data_dir)
File "bash\balt.py", line 1796, in _conversation_wrapper
return func(*args, **kwargs)
File "bash\bosh\bain.py", line 1552, in _projects_walk_cache_wrapper
return func(self, *args, **kwargs)
File "bash\basher\__init__.py", line 2928, in _refresh_installers_if_needed
refresh_info)
File "bash\bosh\bain.py", line 1636, in irefresh
progress, fullRefresh, refresh_info, deleted, pending, projects)
File "bash\bosh\bain.py", line 1552, in _projects_walk_cache_wrapper
return func(self, *args, **kwargs)
File "bash\bosh\bain.py", line 1774, in _refreshInstallers
_index=index, _fullRefresh=fullRefresh)
File "bash\bosh\bain.py", line 1790, in refresh_installer
installer.refreshBasic(progress, recalculate_project_crc=_fullRefresh)
File "bash\bosh\bain.py", line 859, in refreshBasic
return self._refreshBasic(progress, recalculate_project_crc)
File "bash\bosh\bain.py", line 866, in _refreshBasic
self._refreshSource(progress, recalculate_project_crc)
File "bash\bosh\bain.py", line 1432, in _refreshSource
recalculate_project_crc)
File "bash\bosh\bain.py", line 1364, in _refresh_from_project_dir
max_mtime = apRoot.mtime
File "bash\bolt.py", line 778, in _getmtime
return int(os.path.getmtime(self._s))
File "C:\Python27\lib\genericpath.py", line 62, in getmtime
return os.stat(filename).st_mtime
WindowsError: [Error 2] File not found: u'\\home\\infernio\\.wine-bash\\drive_c\\Program Files\\Steam\\steamapps\\common\\Skyrim Mods\\Bash Installers\\test'
Took a long time to figure out what's going on. I *think* this is
because we carry out the shell move first, then hit a refresh due to
wine / Linux / whatever weirdness, and that refresh removes the old
installer from the BAIN data store and creates a new one for whatever
you renamed it to.
The proper solution would be to suspend refreshes while in
_installer_rename (if the cause is indeed a refresh), i.e. making
_instalelr_rename atomic from the perspective of refreshes. In the
absence(?) of such a mechanism, we'll just go with two crappy if
statements - seems to do the job, but is probably racy as hell.1 parent 0c2eaf3 commit 0c1b83e
1 file changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
978 | 978 | | |
979 | 979 | | |
980 | 980 | | |
981 | | - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
982 | 991 | | |
983 | | - | |
984 | | - | |
| 992 | + | |
985 | 993 | | |
986 | 994 | | |
987 | 995 | | |
| |||
0 commit comments