Fix error when installing over existing plugins

As reported in PICARD-444, the following error is received when
installing over an existing plugin:

Traceback (most recent call last):
File ".\picard\ui\options\plugins.py", line 134, in open_plugins
self.install_plugin(path)
File ".\picard\ui\options\plugins.py", line 148, in install_plugin
self.tagger.pluginmanager.install_plugin(path, dest)
File ".\picard\plugin.py", line 198, in install_plugin
same_file = os.path.samefile(path, dest) if dest_exists else False
AttributeError: 'module' object has no attribute 'samefile'
This commit is contained in:
Sophist
2013-09-23 15:15:54 +01:00
committed by Wieland Hoffmann
parent 0f683b8b92
commit 577f2bcabf
2 changed files with 10 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ import picard.plugins
import traceback
from picard import config, log
from picard.const import USER_PLUGIN_DIR
from picard.util import os_path_samefile
_suffixes = [s[0] for s in imp.get_suffixes()]
@@ -195,7 +196,7 @@ class PluginManager(QtCore.QObject):
if plugin_name:
try:
dest_exists = os.path.exists(dest)
same_file = os.path.samefile(path, dest) if dest_exists else False
same_file = os_path_samefile(path, dest) if dest_exists else False
if os.path.isfile(path) and not (dest_exists and same_file):
shutil.copy(path, dest)
elif os.path.isdir(path) and not same_file:

View File

@@ -400,3 +400,11 @@ def tracknum_from_filename(base_filename):
if numbers:
return numbers[0]
return -1
if sys.platform == 'win32':
def os_path_samefile(p1, p2):
ap1 = os.path.abspath(p1)
ap2 = os.path.abspath(p2)
return ap1 == ap2
else:
os_path_samefile = os.path.samefile