ryukinix / mal

MAL: A MyAnimeList Command Line Interface [BROKEN: BLAME MyAnimeList]
https://mal.readthedocs.io
Other
109 stars 9 forks source link

Default file should be in .config/myanimelist #1

Closed masasin closed 8 years ago

masasin commented 8 years ago

For the past few years, it's been best practice on Linux to have programs save their configuration in the .config directory. A subdirectory can be created when there are more than one file pertaining to the same program.

edit:

DEFAULT_FILE = '~/.myanimelist.init' should become DEFAULT_FILE=~/.config/myanimelist, and the readme would have to be updated.

ryukinix commented 8 years ago

Thanks for that suggestion! Is really a better this for Linux! By the way, exists someway to get the config folder for the user using a cross-plataform way? I will do this in soon!

masasin commented 8 years ago

I've only really used Linux for the past 8 years, so I have no idea what everybody else does. Sorry!

masasin commented 8 years ago

You can check the platform using sys.platform. Linux is linux or linux2, OSX is darwin, and Windows is win32 or cygwin

ryukinix commented 8 years ago

Yes, I can do that! But I was wants a way to avoid this, as I don't use OSX I even more Windows, so is a little painful to mantain this. I was checking on sysconfig lib (stdlib), but she don't check the users path. But I found this lib called appdirs! Appears be nice, no?

from the main page:

the problem

What directory should your app use for storing user data? If running on Mac OS X, you should use:

~/Library/Application Support/<AppName>
If on Windows (at least English Win XP) that should be:

C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName>
or possibly:

C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName>
for roaming profiles but that is another story.

On Linux (and other Unices) the dir, according to the XDG spec, is:

~/.local/share/<AppName>

Oy maybe this usersettings lib. I don't know yet which is better. I'll try test in soon and modify this.

masasin commented 8 years ago

I like appdirs. Thank you for this.