Skip to content

Commit

Permalink
Addon Manager: Handle symlinking failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Jan 7, 2022
1 parent 1381744 commit 7ea0394
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Mod/AddonManager/addonmanager_workers.py
Expand Up @@ -1249,9 +1249,15 @@ def run_git_clone(self, clonedir: str) -> None:
if os.path.exists(clonedir):
for f in os.listdir(clonedir):
if f.lower().endswith(".fcmacro"):
utils.symlink(
os.path.join(clonedir, f), os.path.join(macro_dir, f)
)
try:
utils.symlink(
os.path.join(clonedir, f), os.path.join(macro_dir, f)
)
except OSError:
# If the symlink failed (e.g. for a non-admin user on Windows), copy the macro instead
shutil.copy(
os.path.join(clonedir, f), os.path.join(macro_dir, f)
)
FreeCAD.ParamGet(
"User parameter:Plugins/" + self.repo.name
).SetString("destination", clonedir)
Expand Down

0 comments on commit 7ea0394

Please sign in to comment.