7258: Replace os.getcwd() with gramps.gen.constfunc.get_curr_dir()

Py2 on Win32 returns a str from os.getcwd(), which doesn't work with unicode in the path.
New function get_curr_dir() uses the Windows GetCurrentDirectoryW to return a Unicode.
This commit is contained in:
John Ralls
2014-04-20 15:13:31 -07:00
parent 10921cee29
commit ecfad157a8
5 changed files with 34 additions and 11 deletions

View File

@@ -34,8 +34,6 @@ from __future__ import unicode_literals
# python modules
#
#------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
import os
import sys
@@ -62,7 +60,9 @@ from ..dialog import OptionDialog
from ..selectors import SelectorFactory
from gramps.gen.display.name import displayer as _nd
from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules
from gramps.gen.constfunc import cuni, STRTYPE
from gramps.gen.constfunc import conv_to_unicode, uni_to_gui, get_curr_dir
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#------------------------------------------------------------------------
#
@@ -1694,7 +1694,7 @@ class GuiDestinationOption(Gtk.HBox):
name, tail = os.path.split(name)
if not name:
# Avoid infinite loops
name = os.getcwd()
name = get_curr_dir
fcd.set_current_folder(name)
else:
fcd.set_current_name(name)