Fixed an issue with absolute paths on windows.

This commit is contained in:
Joey Payne 2015-02-02 08:30:45 +13:00
commit cc3ce840d9
3 changed files with 7 additions and 4 deletions

View file

@ -140,8 +140,6 @@ class Setting(object):
new_bytes = file.read(extract_path)
except KeyError as e:
log(e)
print e
print e
if new_bytes is not None:
fbytes.append((dest_path, new_bytes))
@ -599,9 +597,10 @@ class CommandBase(object):
if os.path.isabs(f_path):
try:
shutil.copy(setting.value, self.project_dir())
setting.value = os.path.basename(setting.value)
except shutil.Error as e: # same file warning
log('Warning: {}'.format(e))
finally:
setting.value = os.path.basename(setting.value)
os.chdir(old_dir)

View file

@ -1,6 +1,6 @@
from utils import log, open_folder_in_explorer
__gui_version__ = "v0.1.14b"
__gui_version__ = "v0.1.16b"
import os
import glob
@ -519,6 +519,7 @@ class MainWindow(QtGui.QWidget, CommandBase):
QtCore.QDir.currentPath()),
setting.file_types)
if file_path:
file_path = os.path.abspath(file_path) # fixes an issue with windows paths
file_path = file_path.replace(self.project_dir()+os.path.sep, '')
text_obj.setText(file_path)
setting.last_value = file_path

View file

@ -20,6 +20,9 @@ def get_temp_dir():
def log(*args):
if DEBUG:
print(*args)
with open('error.log', 'a+') as f:
f.write(', '.join(args))
f.write('\n')
def open_folder_in_explorer(path):
if platform.system() == "Windows":