diff options
author | 2010-01-26 20:20:39 +0100 | |
---|---|---|
committer | 2010-01-26 20:20:39 +0100 | |
commit | 53c7802ae2ef25ebed4e130813ce95e2816c919b (patch) | |
tree | 24ecf09fc150a1b0f044675dc9974dd4b09def49 /config.py | |
parent | c73778910508d43a247feb868f870ad408c4d360 (diff) | |
download | 4grab-53c7802ae2ef25ebed4e130813ce95e2816c919b.tar.gz 4grab-53c7802ae2ef25ebed4e130813ce95e2816c919b.zip |
Configuration
* A configuration file is made if one hasn't been found
* Certain values (currently download category and location) are stored in config file.
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -17,8 +17,13 @@ class _Configuration(object): self.configparser.add_section("locations") self.configparser.set("locations", "download", self.raw_input_with_default(os.path.join(os.getenv("HOME"), "Pictures"), "Please enter where you would like the downloads to go: ")) - with open(self.filename) as configfile: - self.configparser.write(configfile) + #with open(self.filename) as configfile: + # self.configparser.write(configfile) + dirname = os.path.dirname(self.filename) + if not os.path.exists(dirname): + os.mkdir(dirname) + configfile = open(self.filename, "w") + self.configparser.write(configfile) def raw_input_with_default(self, default, prompt): inp = raw_input("%s (default=%s): " % (prompt, default)) |