From 5ab256d56a484d4b67e961ed21da93091e620d9a Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 4 Jan 2019 16:13:19 +0000 Subject: feature to create initial configuration git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8583 90c681e8-e032-0410-971d-27865f9a5e38 --- src/app/qmmpstarter.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/app/qmmpstarter.cpp') diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index cf537b8de..e78796783 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2018 by Ilya Kotov * + * Copyright (C) 2006-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -68,6 +68,7 @@ QMMPStarter::QMMPStarter() : QObject() #ifdef Q_OS_WIN m_named_mutex = nullptr; #endif + createInitialConfig(); m_option_manager = new BuiltinCommandLineOption(this); QStringList tmp = qApp->arguments().mid(1); @@ -284,6 +285,18 @@ void QMMPStarter::startPlayer() } } +void QMMPStarter::createInitialConfig() +{ + QString defaultConfig = Qmmp::dataPath() + "/qmmprc.default"; + + if(!QFile::exists(Qmmp::configFile()) && QFile::exists(defaultConfig)) + { + qDebug("QMMPStarter: creating initial config"); + QDir("/").mkpath(Qmmp::configDir()); + QFile::copy(defaultConfig, Qmmp::configFile()); + } +} + void QMMPStarter::savePosition() { QSettings settings(Qmmp::configFile(), QSettings::IniFormat); -- cgit v1.2.3-13-gbd6f