diff --git a/src/core/commandlineoptions.cpp b/src/core/commandlineoptions.cpp index 641cb6541..90da55808 100644 --- a/src/core/commandlineoptions.cpp +++ b/src/core/commandlineoptions.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include const char* CommandlineOptions::kHelpText = "%1: clementine [%2] [%3]\n" diff --git a/src/main.cpp b/src/main.cpp index 11445178f..bd00e1d5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -180,16 +180,20 @@ int main(int argc, char *argv[]) { lastfm::ws::SharedSecret = LastFMService::kSecret; #endif - // Parse commandline options - need to do this before starting the - // QApplication so it works without an X server CommandlineOptions options(argc, argv); - if (!options.Parse()) - return 1; { // Only start a core application now so we can check if there's another // Clementine running without needing an X server. + // This MUST be done before parsing the commandline options so QTextCodec + // gets the right system locale for filenames. QtSingleCoreApplication a(argc, argv); + + // Parse commandline options - need to do this before starting the + // full QApplication so it works without an X server + if (!options.Parse()) + return 1; + if (a.isRunning()) { if (options.is_empty()) { qDebug() << "Clementine is already running - activating existing window";