mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #1840
This commit is contained in:
parent
4eab3dcbb8
commit
bfd3086ca6
56
src/main.cpp
56
src/main.cpp
|
@ -116,34 +116,6 @@ int main(int argc, char *argv[])
|
|||
IPC::getInstance();
|
||||
#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
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
|
@ -197,6 +169,34 @@ int main(int argc, char *argv[])
|
|||
if (ipc.isCurrentOwner())
|
||||
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)
|
||||
{
|
||||
QString firstParam(parser.positionalArguments()[0]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user