1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
tux3 2015-06-09 01:45:30 +02:00
parent 4eab3dcbb8
commit bfd3086ca6
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -116,34 +116,6 @@ int main(int argc, char *argv[])
IPC::getInstance(); IPC::getInstance();
#endif #endif
if (parser.isSet("p"))
{
QString profileName = parser.value("p");
if (Profile::exists(profileName))
{
qDebug() << "Setting profile to" << profileName;
if (Profile::isEncrypted(profileName))
{
Settings::getInstance().setCurrentProfile(profileName);
}
else
{
Profile* profile = Profile::loadProfile(profileName);
if (!profile)
{
qCritical() << "-p profile" << profileName + ".tox" << " couldn't be loaded";
return EXIT_FAILURE;
}
Nexus::getInstance().setProfile(profile);
}
}
else
{
qCritical() << "-p profile" << profileName + ".tox" << "doesn't exist";
return EXIT_FAILURE;
}
}
sodium_init(); // For the auto-updater sodium_init(); // For the auto-updater
#ifdef LOG_TO_FILE #ifdef LOG_TO_FILE
@ -197,6 +169,34 @@ int main(int argc, char *argv[])
if (ipc.isCurrentOwner()) if (ipc.isCurrentOwner())
ProfileLocker::clearAllLocks(); ProfileLocker::clearAllLocks();
if (parser.isSet("p"))
{
QString profileName = parser.value("p");
if (Profile::exists(profileName))
{
qDebug() << "Setting profile to" << profileName;
if (Profile::isEncrypted(profileName))
{
Settings::getInstance().setCurrentProfile(profileName);
}
else
{
Profile* profile = Profile::loadProfile(profileName);
if (!profile)
{
qCritical() << "-p profile" << profileName + ".tox" << " couldn't be loaded";
return EXIT_FAILURE;
}
Nexus::getInstance().setProfile(profile);
}
}
else
{
qCritical() << "-p profile" << profileName + ".tox" << "doesn't exist";
return EXIT_FAILURE;
}
}
if (parser.positionalArguments().size() > 0) if (parser.positionalArguments().size() > 0)
{ {
QString firstParam(parser.positionalArguments()[0]); QString firstParam(parser.positionalArguments()[0]);