1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-20 06:25:02 +01:00

Fix the parsing of Finder command line options.

Fixes issue #537
This commit is contained in:
John Maguire 2010-07-24 14:57:56 +00:00
parent f3491add62
commit 3f78df5725
2 changed files with 14 additions and 8 deletions

View File

@ -71,6 +71,20 @@ CommandlineOptions::CommandlineOptions(int argc, char** argv)
engine_(Engine::Type_QtPhonon)
#endif
{
#ifdef Q_OS_DARWIN
// Remove -psn_xxx option that Mac passes when opened from Finder.
for (int i = 0; i < argc_; ++i) {
QString opt(argv_[i]);
if (opt.startsWith("-psn")) {
// Shuffle remaining args.
for (int j = i; j < argc_; ++j) {
argv_[j] = argv_[j+1];
}
--argc_;
break;
}
}
#endif
}
bool CommandlineOptions::Parse() {

View File

@ -86,14 +86,6 @@ int main(int argc, char *argv[]) {
// Do Mac specific startup to get media keys working.
// This must go before QApplication initialisation.
mac::MacMain();
// Strip mac command line option.
for (int i = 0; i < argc; ++i) {
QString arg(argv[i]);
if (arg.startsWith("-psn")) {
argv[i][0] = '\0';
}
}
#endif
QCoreApplication::setApplicationName("Clementine");