Browse code

* s3cmd: Don't require $HOME env variable to be set. Fixes #2000133

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@197 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/06/23 13:01:04
Showing 2 changed files
... ...
@@ -1,5 +1,7 @@
1 1
 2008-06-23  Michal Ludvig  <michal@logix.cz>
2 2
 
3
+	* s3cmd: Don't require $HOME env variable to be set.
4
+	  Fixes #2000133
3 5
 	* s3cmd: Wrapped all execution in a try/except block
4 6
 	  to catch all exceptions and ask for a report.
5 7
 
... ...
@@ -862,7 +862,9 @@ def main():
862 862
 	optparser = OptionParser(option_class=OptionMimeType, formatter=MyHelpFormatter())
863 863
 	#optparser.disable_interspersed_args()
864 864
 
865
-	optparser.set_defaults(config=os.getenv("HOME")+"/.s3cfg")
865
+	if os.getenv("HOME"):
866
+		optparser.set_defaults(config=os.getenv("HOME")+"/.s3cfg")
867
+
866 868
 	optparser.set_defaults(verbosity = default_verbosity)
867 869
 
868 870
 	optparser.add_option(      "--configure", dest="run_configure", action="store_true", help="Invoke interactive (re)configuration tool.")
... ...
@@ -916,6 +918,10 @@ def main():
916 916
 		sys.exit(0)
917 917
 
918 918
 	## Now finally parse the config file
919
+	if not options.config:
920
+		error("Can't find a config file. Please use --config option.")
921
+		sys.exit(1)
922
+
919 923
 	try:
920 924
 		cfg = Config(options.config)
921 925
 	except IOError, e: