From 89596ed50a67f38c57214a3880def4d6b1701266 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sat, 9 Oct 2010 16:46:26 +0200 Subject: [PATCH] Added symlink fallback if hard link do not work. --- mlmanager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mlmanager.py b/mlmanager.py index 5febdc7..8df2bb5 100644 --- a/mlmanager.py +++ b/mlmanager.py @@ -272,7 +272,12 @@ class Download(): if self._network != "BitTorrent": shutil.move (self._dest_path, destination_folder + filename) else: - os.link (self._dest_path, destination_folder + filename) + # Try hard link first (that will work only for files + # and only on the same filesystem, and symlink after + try: + os.link (self._dest_path, destination_folder + filename) + except: + os.symlink (self._dest_path, destination_folder + filename) # Update _dest_path self._dest_path = destination_folder + filename -- 2.1.4