Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Config file location on Windows #242
Comments
|
Note that even on Windows, we should fall back to |
|
I have two questions:
|
Most programs create their own directory directly under A slightly less common hierarchy is Finally, some just use I would choose either 1) or 3) for youtube-dl. Using 2) is okay but a little too verbose, seeing that you only have one program with one config file. In the end, anything is okay as long as it's tidy. Edit: As for official guidelines, I've found a MSDN section "Windows 2000 Application Specifications", whose section 4 describes application data storage. It suggests Note: Even on Unix, all programs using XDG_CONFIG_HOME use a separate subdirectory – for example,
This function was only introduced in Windows Vista, as its MSDN doc page says. In contrast, |
|
youtube-dl uses now |
|
|
|
I've been using Are you absolutely positive that the filename is |
|
Personally I put my "portable" programs in a custom high-level folder because the User and Appdata folders are awkward to use. I think the configuration file should be allowed in the program directory; your reference to standard locations is very well thought out, but the vast majority of "project" software like this keep their config.ini folder in the program directory. It's where I have to go to run the program, and I won't lose it if I move the program/reformat/etc and forget its config is in an arbitrary separate location. Large/complex software like MS Office or Firefox seems to be more what separate Appdata or user-folder configs is best for. tldr it would be nice if the file would be recognized in the program's own folder, whether config.txt, youtube-dl.conf, or the more traditional config.ini :) |
|
Does config file created by default ? Or is it created after a commands in youtube dl ? |
|
You have to create that file manually.. |
|
Still no way to have a global system wide config file in Windows |
|
I don't know if this may help somebody, but I tried to put the config file in C:\Users\MyUserName\AppData\Roaming\youtube-dl\config.txt and it works as intended. |
|
This should be the same path, actually. |
|
Ohh I understand now. %APPDATA% is a shortcut for Thanks for the hint. |
|
Yep, exactly |

Currently, youtube-dl uses Unix-specific locations (XDG_CONFIG_HOME) for finding the configuration files. On Windows, "Application Data" is a better location for this, and the proper way to find it is by using
SHGetFolderPath(), as in this example.(Windows also provides
os.environ["APPDATA"], but this is somewhat less reliable, and does not exist in some uncommon situations.)