From af772feb0e485ab984f46c0c56cc0721a3f24044 Mon Sep 17 00:00:00 2001 From: Connectety-T Date: Sun, 22 Mar 2020 13:55:50 +0100 Subject: [PATCH] do nothing when trying to create a symlink to desktop-integration-folders and one is already there. (closes #2598) --- lutris/util/wine/prefix.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lutris/util/wine/prefix.py b/lutris/util/wine/prefix.py index 3d6a0f036..97a0b490f 100644 --- a/lutris/util/wine/prefix.py +++ b/lutris/util/wine/prefix.py @@ -117,7 +117,11 @@ class WinePrefixManager: except OSError: os.rename(path, old_path) - if restore and not os.path.isdir(path): + # if we want to create a symlink and one is already there, just skip to the next item. + # this also makes sure the elif doesn't find a dir (isdir only looks at the target of the symlink). + if restore and os.path.islink(path): + continue + elif restore and not os.path.isdir(path): os.symlink(xdgshortcuts.get_xdg_entry(DESKTOP_XDG[i]), path) # We don't need all the others process of the loop continue