1
0
mirror of https://github.com/lutris/lutris synced 2024-07-08 19:45:47 +00:00

Don't raise an error when initial path doesn't exist in game.move

This commit is contained in:
Mathieu Comandon 2024-04-06 21:58:54 -07:00
parent 50ee3af168
commit 8ca5136bb7

View File

@ -1040,15 +1040,6 @@ class Game(GObject.Object):
old_location = self.directory
target_directory = self._get_move_target_directory(new_location)
# Raise errors before actually changing anything!
if not old_location:
raise InvalidGameMoveError(_("The game has no location currently set, so it can't be moved."))
if not system.path_exists(old_location):
raise InvalidGameMoveError(
_("The location '%s' does not exist, perhaps the files have already been moved?") % old_location
)
if new_location.startswith(old_location):
raise InvalidGameMoveError(
_("Lutris can't move '%s' to a location inside of itself, '%s'.") % (old_location, new_location)
@ -1066,6 +1057,10 @@ class Game(GObject.Object):
with open(self.config.game_config_path, "w", encoding="utf-8") as config_file:
config_file.write(new_config)
if not system.path_exists(old_location):
logger.warning("Initial location %s does not exist, files may have already been moved.")
return
try:
shutil.move(old_location, new_location)
except OSError as ex: