]> jfr.im git - z_archive/twitter.git/commitdiff
Fix Issue #60 can't write config file on Windows
authorAnmar Mansur <redacted>
Fri, 11 Jan 2013 17:46:50 +0000 (10:46 -0700)
committerAnmar Mansur <redacted>
Fri, 11 Jan 2013 17:46:50 +0000 (10:46 -0700)
Windows doesn't have a HOME environment variable. The config file ends up being written to the root of system drive, hence the need for admin rights. Windows does however define a USERPROFILE environment variable that points correctly to the logged in user's profile home folder where most Python programs store their settings. Tested on Windows 7 x64 and Windows 8 x64.

twitter/cmdline.py

index 3147f61c4af0d3d026011f78a1473d845b0e954b..01bb683d331dc490ccb2951e1020f1215e68b2c9 100644 (file)
@@ -105,8 +105,8 @@ OPTIONS = {
     'refresh_rate': 600,
     'format': 'default',
     'prompt': '[cyan]twitter[R]> ',
-    'config_filename': os.environ.get('HOME', '') + os.sep + '.twitter',
-    'oauth_filename': os.environ.get('HOME', '') + os.sep + '.twitter_oauth',
+    'config_filename': os.environ.get('HOME', os.environ.get('USERPROFILE', '')) + os.sep + '.twitter',
+    'oauth_filename': os.environ.get('HOME', os.environ.get('USERPROFILE', '')) + os.sep + '.twitter_oauth',
     'length': 20,
     'timestamp': False,
     'datestamp': False,