Browse code

Add fallback for old windows versions

GuillaumeCisco authored on 2014/05/07 20:39:05
Showing 2 changed files
... ...
@@ -38,7 +38,7 @@ config_file = None
38 38
 if os.getenv("HOME"):
39 39
     config_file = os.path.join(os.getenv("HOME"), ".s3cfg")
40 40
 elif os.name == "nt" and os.getenv("USERPROFILE"):
41
-    config_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), os.getenv("APPDATA").decode('mbcs'), "s3cmd.ini")
41
+    config_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), os.getenv("APPDATA").decode('mbcs') or 'Application Data', "s3cmd.ini")
42 42
 
43 43
 cfg = S3.Config.Config(config_file)
44 44
 
... ...
@@ -2035,7 +2035,7 @@ def main():
2035 2035
     if os.getenv("S3CMD_CONFIG"):
2036 2036
         config_file = os.getenv("S3CMD_CONFIG")
2037 2037
     elif os.name == "nt" and os.getenv("USERPROFILE"):
2038
-        config_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), os.getenv("APPDATA").decode('mbcs'), "s3cmd.ini")
2038
+        config_file = os.path.join(os.getenv("USERPROFILE").decode('mbcs'), os.getenv("APPDATA").decode('mbcs') or 'Application Data', "s3cmd.ini")
2039 2039
     else:
2040 2040
         from os.path import expanduser
2041 2041
         config_file = os.path.join(expanduser("~"), ".s3cfg")