aboutsummaryrefslogtreecommitdiff
path: root/src/singleapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/singleapplication.cpp')
-rw-r--r--src/singleapplication.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/singleapplication.cpp b/src/singleapplication.cpp
index 2356fc2..720690d 100644
--- a/src/singleapplication.cpp
+++ b/src/singleapplication.cpp
@@ -14,13 +14,6 @@
SingleApplication::SingleApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
-#ifdef Q_OS_UNIX
- // could be a path such as "/tmp/foo"
- LOCALSERVER_KEY = "smolbote_socket";
-#elif Q_OS_WIN32
- // could be a pipe path such as "\\.\pipe\foo"
- LOCALSERVER_KEY = "\\.\pipe\smolbote_socket";
-#endif
}
SingleApplication::~SingleApplication()
@@ -39,10 +32,7 @@ SingleApplication::~SingleApplication()
*/
bool SingleApplication::bindLocalSocket(const QString &name)
{
- // if a name has been set
- if(!name.isEmpty()) {
- LOCALSERVER_KEY = name;
- }
+ LOCALSERVER_KEY = name;
QLocalSocket socket;
socket.connectToServer(LOCALSERVER_KEY);
@@ -60,11 +50,7 @@ bool SingleApplication::bindLocalSocket(const QString &name)
// no other server
QLocalServer::removeServer(LOCALSERVER_KEY);
- if(!m_localServer->listen(LOCALSERVER_KEY)) {
- // for some reason, we still can't bind the socket
- return false;
- }
- return true;
+ return m_localServer->listen(LOCALSERVER_KEY);
}
}