google-code-export / fanficdownloader

Automatically exported from code.google.com/p/fanficdownloader
0 stars 0 forks source link

Current INI parse order in CLI seems backwards #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
My apologies if I misunderstand how this code should be behaving.  I assume 
that config fragments in ~/.fanficdownloader should override values set in the 
appdir/*.init files.  Appdir files are currently taking precedence.

What steps will reproduce the problem?
1. Create a ~/.fanficdownloader/personal.ini with an output_filename value 
different from the app default
2. Run the download
3. The output_filename will be the appdir/defaults.init value

This is what fixed it for me to behave like I expected:

diff -r 736b41f0b95c downloader.py
--- a/downloader.py Sun Jan 01 09:26:17 2012 -0600
+++ b/downloader.py Sun Jan 01 17:09:02 2012 -0500
@@ -84,14 +84,14 @@

    conflist = []
    homepath = join(expanduser("~"),".fanficdownloader")
+   if isfile("defaults.ini"):
+       conflist.append("defaults.ini")
+   if isfile("personal.ini"):
+       conflist.append("personal.ini")
    if isfile(join(homepath,"defaults.ini")):
        conflist.append(join(homepath,"defaults.ini"))
    if isfile(join(homepath,"personal.ini")):
        conflist.append(join(homepath,"personal.ini"))
-   if isfile("defaults.ini"):
-       conflist.append("defaults.ini")
-   if isfile("personal.ini"):
-       conflist.append("personal.ini")
    if options.configfile:
        conflist.extend(options.configfile)

Original issue reported on code.google.com by andrew....@gmail.com on 1 Jan 2012 at 10:11

GoogleCodeExporter commented 9 years ago
It isn't ~/.fanficdownloader vs appdir, it's ~/.fanficdownloader vs pwd.  

It's not unreasonable to expect ini files in pwd to take precedence over those 
in ~/.fanficdownloader.

It's also not unreasonable to expect personal.ini in ~/.fanficdownloader to 
take precedence over ./defaults.ini, which I think is what really happened.

It's sort of a grey area, having two ini files and allowing both in two places. 
 Backward compatibility is sometimes a pain.

Would you be satisfied with a precedence of:

~/.fanficdownloader/defaults.ini
./defaults.ini
~/.fanficdownloader/personal.ini
./personal.ini

Sorry I didn't see this earlier--the project doesn't send notices of new issues.

Original comment by retiefj...@gmail.com on 16 Jan 2012 at 8:58

GoogleCodeExporter commented 9 years ago
Changed as described above.

Original comment by retiefj...@gmail.com on 18 Jan 2012 at 1:29