and a little class example for da dude
This commit is contained in:
Gabor Körber 2017-05-24 21:09:53 +02:00
parent f3474310d0
commit 4e3884b55a
3 changed files with 16 additions and 0 deletions

View File

@ -138,6 +138,22 @@ if __name__ == '__main__':
print('Locale Get Preferred Encoding is ', locale.getpreferredencoding()) print('Locale Get Preferred Encoding is ', locale.getpreferredencoding())
print('File System Encoding is ', sys.getfilesystemencoding()) 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(), print('The UserConfig xml is saved as ', settings.detect_encoding(os.path.join(settings.get_config_path(),
'user_config.xml'))) 'user_config.xml')))