Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Error in Error message for moving between different drives #416

Closed
kopilo opened this issue Mar 13, 2022 · 1 comment
Closed

Minor Error in Error message for moving between different drives #416

kopilo opened this issue Mar 13, 2022 · 1 comment

Comments

@kopilo
Copy link

kopilo commented Mar 13, 2022

[cli] INFO: Moving "GTAV" from "C:/Legendary" to "S:\GTAV"
[cli] ERROR: Moving to a different drive is not supported. Move the folder manually to "S:\GTAV\GTAV" and then run "legendary 9d2d0eb64d5c44529cece33fe2a46482 "S:\GTAV" --skip-move"
Command in message should be:
legendary move 9d2d0eb64d5c44529cece33fe2a46482 "S:\GTAV" --skip-move

Platform

Operating system and version:
Windows 10 Home
legendary version "0.20.25", codename "Our Benefactors"

@woctezuma
Copy link
Contributor

woctezuma commented Mar 13, 2022

The error happened here:

legendary/legendary/cli.py

Lines 2468 to 2477 in 3d1042e

if not args.skip_move:
try:
if not os.path.exists(args.new_path):
os.makedirs(args.new_path)
os.rename(igame.install_path, new_path)
except Exception as e:
if isinstance(e, OSError) and e.errno == 18:
logger.error(f'Moving to a different drive is not supported. Move the folder manually to '
f'"{new_path}" and then run "legendary {app_name} "{args.new_path}" --skip-move"')

Apparently, OSError: [Errno 18] Invalid cross-device link happens because of the use of os.rename:

os.rename only works if source and destination are on the same file system. You should use shutil.move instead.

Reference: https://stackoverflow.com/a/43967659

If the destination is on the current filesystem, then os.rename() is used. Otherwise, src is copied to dst using copy_function and then removed.

Reference: https://docs.python.org/3/library/shutil.html#shutil.move

@derrod derrod closed this as completed in 40748a9 Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants