settings: provide a way to use alternative location for configuration file

..and whole data folder.
This commit is contained in:
Andrzej Rybczak
2011-11-13 20:08:03 +01:00
parent 62157909d5
commit a98a1800a7
15 changed files with 155 additions and 100 deletions

View File

@@ -125,6 +125,7 @@ void ParseArgv(int argc, char **argv)
<< "Usage: ncmpcpp [OPTION]...\n"
<< " -h, --host connect to server at host [localhost]\n"
<< " -p, --port connect to server at port [6600]\n"
<< " -c, --config use alternative configuration file\n"
<< " -s, --screen <name> specify the startup screen\n"
<< " -?, --help show this help message\n"
<< " -v, --version display version information\n"
@@ -142,7 +143,7 @@ void ParseArgv(int argc, char **argv)
}
if (!ConnectToMPD())
exit(0);
exit(1);
if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen"))
{
@@ -258,6 +259,11 @@ void ParseArgv(int argc, char **argv)
Mpd.SetVolume(Mpd.GetVolume()+atoi(argv[i]));
quit = 1;
}
else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config"))
{
// this is used in NcmpcppConfig::CheckForCommandLineConfigFilePath, ignoring here.
++i;
}
else
{
std::cout << "ncmpcpp: invalid option: " << argv[i] << std::endl;