def moveSave(oldSave,newSave): """Temporarilty moves quicksave.ess to quicktemp.ess.""" #--Use path.tail to prevent access outside of saves directory oldPath = data.savesDir.join(GPath(oldSave).tail) newPath = data.savesDir.join(GPath(newSave).tail) if newPath.exists() and not newPath.isfile(): raise bolt.BoltError(newPath+_(' exists and is not a save file.')) if oldPath.exists(): if not oldPath.isfile(): raise bolt.BoltError(oldPath+_(' is not a save file.')) oldPath.moveTo(newPath) bosh.CoSaves(oldPath).move(newPath)
def __init__(self, loadOrder=__empty, active=__none): if set(active) - set(loadOrder): raise bolt.BoltError( u'Active mods with no load order: ' + u', '.join([x.s for x in (set(active) - set(loadOrder))])) self._loadOrder = tuple(loadOrder) self._active = frozenset(active) self.__mod_loIndex = dict((a, i) for i, a in enumerate(loadOrder)) # would raise key error if active have no loadOrder self._activeOrdered = tuple( sorted(active, key=self.__mod_loIndex.__getitem__)) self.__mod_actIndex = dict( (a, i) for i, a in enumerate(self._activeOrdered))
if move.exists(): move.copyTo(_plugins_txt_path) _plugins_txt_path.mtime = time.time( ) # copy will not change mtime, bad move = newPath.join(u'loadorder.txt') if move.exists(): move.copyTo(_loadorder_txt_path) _loadorder_txt_path.mtime = time.time( ) #update mtime to trigger refresh #----------------------------------------------------------------------REFACTOR _liblo_handle, _liblo_error = _liblo.Init(bosh.dirs['compiled'].s) # That didn't work - Wrye Bash isn't installed correctly if not _liblo.liblo: raise bolt.BoltError(u'The libloadorder API could not be loaded.') bolt.deprint(u'Using libloadorder API version:', _liblo.version) _liblo_handle = _liblo_handle(bosh.dirs['app'].s, bush.game.fsName, bosh.dirs['userApp'].s) if bush.game.fsName == u'Oblivion' and bosh.dirs['mods'].join( u'Nehrim.esm').isfile(): _liblo_handle.SetGameMaster(u'Nehrim.esm') if bosh.dirs['saveBase'] == bosh.dirs['app']: #--If using the game directory as rather than the appdata dir. _dir = bosh.dirs['app'] else: _dir = bosh.dirs['userApp'] _plugins_txt_path = _dir.join(u'plugins.txt') _loadorder_txt_path = _dir.join(u'loadorder.txt')