From 066821b011045b52c9c0bc76abdd6683254e900b Mon Sep 17 00:00:00 2001 From: skomoroh Date: Thu, 3 Dec 2009 19:25:06 +0000 Subject: [PATCH] * some fixes for windows git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@254 efabe8c0-fbe8-4139-b769-b5e6d273206e --- pysollib/init.py | 6 +++--- pysollib/mfxutil.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pysollib/init.py b/pysollib/init.py index a4904afc..6a1e9336 100644 --- a/pysollib/init.py +++ b/pysollib/init.py @@ -149,10 +149,10 @@ def init(): if sys.path[0] and not os.path.isdir(sys.path[0]): # i.e. library.zip d = os.path.dirname(sys.path[0]) os.chdir(d) # for read presets - fcs_command = os.path.join('freecell-solver', 'fc-solve.exe') + fcs_command = os.path.join('freecell-solver', 'bin', 'fc-solve.exe') settings.FCS_COMMAND = fcs_command - ##f = os.path.join(d, 'freecell-solver', 'presetrc') - ##os.environ['FREECELL_SOLVER_PRESETRC'] = f # defined in prefix.h + f = os.path.join('freecell-solver', 'presetrc') + os.environ['FREECELL_SOLVER_PRESETRC'] = f if os.name in ('posix', 'nt'): try: kw = {'shell': True, diff --git a/pysollib/mfxutil.py b/pysollib/mfxutil.py index 13d3a006..b9774a6a 100644 --- a/pysollib/mfxutil.py +++ b/pysollib/mfxutil.py @@ -134,9 +134,16 @@ if os.name == "posix": def win32_getusername(): user = os.environ.get('USERNAME','').strip() + try: + user = unicode(user, locale.getpreferredencoding()) + except: + user = '' return user def win32_getprefdir(package): + portprefdir = 'config' # portable varsion + if os.path.isdir(portprefdir): + return portprefdir # %USERPROFILE%, %APPDATA% hd = os.environ.get('APPDATA') if not hd: