From 9e4b1a4d3287efceb6f3c8e0477c0ec3c3c2b9c9 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Wed, 15 Feb 2012 22:29:57 -0800 Subject: [PATCH] Possible temporary fix for non-ascii usernames --- ostools.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ostools.py b/ostools.py index 85e0e9e..3ee17ee 100644 --- a/ostools.py +++ b/ostools.py @@ -27,9 +27,15 @@ def osVer(): return " ".join(platform.linux_distribution()) def getDataDir(): - if isOSX(): - return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") - elif isLinux(): - return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/") - else: - return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/") + # Temporary fix for non-ascii usernames + # If username has non-ascii characters, just store userdata + # in the Pesterchum install directory (like before) + try: + if isOSX(): + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") + elif isLinux(): + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/") + else: + return os.path.join(unicode(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/") + except UnicodeDecodeError: + return ''