From 4e3884b55adf6794504d0e538ef8d03dfc6684e4 Mon Sep 17 00:00:00 2001 From: Gabor Guzmics Date: Wed, 24 May 2017 21:09:53 +0200 Subject: [PATCH] cleanups and a little class example for da dude --- src/scon/config/settings.py | 16 ++++++++++++++++ src/scon/{game => stuff}/pieces.py | 0 src/scon/{gui => stuff}/qbrowser.py | 0 3 files changed, 16 insertions(+) rename src/scon/{game => stuff}/pieces.py (100%) rename src/scon/{gui => stuff}/qbrowser.py (100%) diff --git a/src/scon/config/settings.py b/src/scon/config/settings.py index b8b9677..18c9818 100644 --- a/src/scon/config/settings.py +++ b/src/scon/config/settings.py @@ -138,6 +138,22 @@ if __name__ == '__main__': print('Locale Get Preferred Encoding is ', locale.getpreferredencoding()) print('File System Encoding is ', sys.getfilesystemencoding()) + + print('Expanduser tells me home directory is in %s' % os.path.expanduser('~')) + if not os.path.exists(os.path.expanduser('~')): + logging.error('Expanduser Folder does not exist.') + + # winapi + import ctypes.wintypes + CSIDL = 0x28 # CSIDL_PROFILE + SHGFP_TYPE_CURRENT = 0 # Get current, not default value + buf= ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) + ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL, None, SHGFP_TYPE_CURRENT, buf) + windows_user_folder = buf.value + print('Windows itself tells me its in %s' % windows_user_folder) + if not os.path.exists(windows_user_folder): + logging.error('Even that Folder does not exist.') + print('The UserConfig xml is saved as ', settings.detect_encoding(os.path.join(settings.get_config_path(), 'user_config.xml'))) diff --git a/src/scon/game/pieces.py b/src/scon/stuff/pieces.py similarity index 100% rename from src/scon/game/pieces.py rename to src/scon/stuff/pieces.py diff --git a/src/scon/gui/qbrowser.py b/src/scon/stuff/qbrowser.py similarity index 100% rename from src/scon/gui/qbrowser.py rename to src/scon/stuff/qbrowser.py