mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-18 03:41:50 +03:00
41c9e90852
run. This should hopefully prevent corruption of the sync directory.
25 lines
641 B
C++
25 lines
641 B
C++
#include <QtGui/QApplication>
|
|
#include "SyncWindow.h"
|
|
#include <QSharedMemory>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// Technique for having only one application running at the same time per
|
|
// computer.
|
|
QSharedMemory sharedMemory;
|
|
sharedMemory.setKey("8SyGEyz2kcI0UNrqxc7wcuKLjD1pSL8GezlBM1W0QckgpjMon0");
|
|
if(sharedMemory.attach()) {
|
|
return -1;
|
|
}
|
|
|
|
if (!sharedMemory.create(1)) {
|
|
return -1; // Exit already a process running
|
|
}
|
|
|
|
// Great. No other instance is running, so we can run the program.
|
|
QApplication a(argc, argv);
|
|
SyncWindow w;
|
|
w.show();
|
|
|
|
return a.exec();
|
|
}
|