0002655: Directories and files with accents characters cause failures in Windows.
svn: r12106
This commit is contained in:
parent
bc081c401c
commit
bff93f186a
@ -160,11 +160,11 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
filename = Utils.get_unicode_path(self.file_text.get_filename())
|
filename = Utils.get_unicode_path(self.file_text.get_filename())
|
||||||
full_file = filename
|
full_file = filename
|
||||||
|
|
||||||
pname = Utils.media_path(self.dbase)
|
pname = unicode(Utils.media_path(self.dbase))
|
||||||
if self.relpath.get_active():
|
if self.relpath.get_active():
|
||||||
filename = Utils.relative_path(filename, pname)
|
filename = Utils.relative_path(filename, pname)
|
||||||
|
|
||||||
if os.path.exists(pname) == 0:
|
if not os.path.exists(pname):
|
||||||
msgstr = _("Cannot import %s")
|
msgstr = _("Cannot import %s")
|
||||||
msgstr2 = _("The filename supplied could not be found.")
|
msgstr2 = _("The filename supplied could not be found.")
|
||||||
ErrorDialog(msgstr % filename, msgstr2)
|
ErrorDialog(msgstr % filename, msgstr2)
|
||||||
|
@ -439,8 +439,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
|||||||
#Allow for exotic error: file is still not correct
|
#Allow for exotic error: file is still not correct
|
||||||
self.check_fileselect(self.chooser, show=False)
|
self.check_fileselect(self.chooser, show=False)
|
||||||
if self.get_page_complete(self.chooser) :
|
if self.get_page_complete(self.chooser) :
|
||||||
filename = unicode(self.chooser.get_filename(),
|
filename = Utils.get_unicode_path(self.chooser.get_filename())
|
||||||
sys.getfilesystemencoding())
|
|
||||||
name = os.path.split(filename)[1]
|
name = os.path.split(filename)[1]
|
||||||
folder = os.path.split(filename)[0]
|
folder = os.path.split(filename)[0]
|
||||||
confirm_text = _(
|
confirm_text = _(
|
||||||
@ -563,8 +562,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
|||||||
Depending on the success status, set the text for the final page.
|
Depending on the success status, set the text for the final page.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
filename = unicode(self.chooser.get_filename(),
|
filename = Utils.get_unicode_path(self.chooser.get_filename())
|
||||||
sys.getfilesystemencoding())
|
|
||||||
Config.set(Config.RECENT_EXPORT_DIR, os.path.split(filename)[0])
|
Config.set(Config.RECENT_EXPORT_DIR, os.path.split(filename)[0])
|
||||||
ix = self.get_selected_format_index()
|
ix = self.get_selected_format_index()
|
||||||
Config.set(Config.RECENT_EXPORT_TYPE, ix)
|
Config.set(Config.RECENT_EXPORT_TYPE, ix)
|
||||||
|
@ -1261,7 +1261,7 @@ class GuiDestinationOption(gtk.HBox):
|
|||||||
|
|
||||||
status = fcd.run()
|
status = fcd.run()
|
||||||
if status == gtk.RESPONSE_OK:
|
if status == gtk.RESPONSE_OK:
|
||||||
path = unicode(fcd.get_filename(), sys.getfilesystemencoding())
|
path = Utils.get_unicode_path(fcd.get_filename())
|
||||||
if path:
|
if path:
|
||||||
if not self.__option.get_directory_entry() and \
|
if not self.__option.get_directory_entry() and \
|
||||||
not path.endswith(self.__option.get_extension()):
|
not path.endswith(self.__option.get_extension()):
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import gtk
|
import gtk
|
||||||
|
import Utils
|
||||||
|
|
||||||
class FileEntry(gtk.HBox):
|
class FileEntry(gtk.HBox):
|
||||||
def __init__(self,defname,title):
|
def __init__(self,defname,title):
|
||||||
@ -68,8 +69,7 @@ class FileEntry(gtk.HBox):
|
|||||||
f.present()
|
f.present()
|
||||||
status = f.run()
|
status = f.run()
|
||||||
if status == gtk.RESPONSE_OK:
|
if status == gtk.RESPONSE_OK:
|
||||||
self.set_filename(unicode(f.get_filename(),
|
self.set_filename(Utils.get_unicode_path(f.get_filename()))
|
||||||
sys.getfilesystemencoding()))
|
|
||||||
f.destroy()
|
f.destroy()
|
||||||
|
|
||||||
def set_filename(self,path):
|
def set_filename(self,path):
|
||||||
|
@ -1128,7 +1128,6 @@ def open_file_with_default_application( file_path ):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if os.sys.platform == 'win32':
|
if os.sys.platform == 'win32':
|
||||||
norm_path = norm_path.encode(os.sys.getfilesystemencoding())
|
|
||||||
try:
|
try:
|
||||||
os.startfile(norm_path)
|
os.startfile(norm_path)
|
||||||
except WindowsError, msg:
|
except WindowsError, msg:
|
||||||
|
@ -185,7 +185,7 @@ class PackageWriter:
|
|||||||
# during the process (i.e. when removing object)
|
# during the process (i.e. when removing object)
|
||||||
for m_id in self.db.get_media_object_handles():
|
for m_id in self.db.get_media_object_handles():
|
||||||
mobject = self.db.get_object_from_handle(m_id)
|
mobject = self.db.get_object_from_handle(m_id)
|
||||||
filename = str(Utils.media_path_full(self.db, mobject.get_path()))
|
filename = Utils.media_path_full(self.db, mobject.get_path())
|
||||||
archname = str(mobject.get_path())
|
archname = str(mobject.get_path())
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
archive.add(filename, archname)
|
archive.add(filename, archname)
|
||||||
|
@ -523,8 +523,7 @@ class CheckIntegrity:
|
|||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
|
|
||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
name = unicode(fs_top.get_filename(),
|
name = Utils.get_unicode_path(fs_top.get_filename())
|
||||||
sys.getfilesystemencoding())
|
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
obj = self.db.get_object_from_handle(ObjectId)
|
obj = self.db.get_object_from_handle(ObjectId)
|
||||||
obj.set_path(name)
|
obj.set_path(name)
|
||||||
|
@ -399,8 +399,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
|
|||||||
f.hide()
|
f.hide()
|
||||||
|
|
||||||
if status == gtk.RESPONSE_OK:
|
if status == gtk.RESPONSE_OK:
|
||||||
name = unicode(f.get_filename(),
|
name = Utils.get_unicode_path(f.get_filename())
|
||||||
sys.getfilesystemencoding())
|
|
||||||
doc = ODSTab(len(self.row_data))
|
doc = ODSTab(len(self.row_data))
|
||||||
doc.creator(self.db.get_researcher().get_name())
|
doc.creator(self.db.get_researcher().get_name())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user