mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
Don't raise an error when initial path doesn't exist in game.move
This commit is contained in:
parent
50ee3af168
commit
8ca5136bb7
|
@ -1040,15 +1040,6 @@ class Game(GObject.Object):
|
||||||
old_location = self.directory
|
old_location = self.directory
|
||||||
target_directory = self._get_move_target_directory(new_location)
|
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):
|
if new_location.startswith(old_location):
|
||||||
raise InvalidGameMoveError(
|
raise InvalidGameMoveError(
|
||||||
_("Lutris can't move '%s' to a location inside of itself, '%s'.") % (old_location, new_location)
|
_("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:
|
with open(self.config.game_config_path, "w", encoding="utf-8") as config_file:
|
||||||
config_file.write(new_config)
|
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:
|
try:
|
||||||
shutil.move(old_location, new_location)
|
shutil.move(old_location, new_location)
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
|
|
Loading…
Reference in a new issue