aboutsummaryrefslogtreecommitdiff
path: root/src/commandline.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-30 19:23:34 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-30 19:23:34 +0100
commit705249718c3172cf845f8525d9867a29fe1240fa (patch)
tree7fafee76b2d371284ebd9ad8ba011df1e7664eab /src/commandline.cpp
parentProfile menu lists loadable profiles (diff)
downloadsmolbote-705249718c3172cf845f8525d9867a29fe1240fa.tar.xz
Always connect to local socket
Diffstat (limited to 'src/commandline.cpp')
-rw-r--r--src/commandline.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/commandline.cpp b/src/commandline.cpp
index e10e638..ffd7957 100644
--- a/src/commandline.cpp
+++ b/src/commandline.cpp
@@ -33,6 +33,17 @@ QString defaultUserConfigLocation()
return path;
}
+constexpr const char *socketPath()
+{
+#ifdef Q_OS_UNIX
+ // could be a path such as "/tmp/foo"
+ return "/tmp/smolbote.socket";
+#elif Q_OS_WIN32
+ // could be a pipe path such as "\\.\pipe\foo"
+ return = "\\\\.\\pipe\\smolbote_socket";
+#endif
+}
+
CommandLine::CommandLine()
: QCommandLineParser()
, helpOption(addHelpOption())
@@ -40,7 +51,7 @@ CommandLine::CommandLine()
, configOption({ "c", "config" }, "Set configuration file.", "path", defaultUserConfigLocation())
, defaultConfigOption("default-config", "Set the default configuration file.", "path", "")
, profileOption({ "p", "profile" }, "Use this profile.", "profile", "")
- , socketOption("socket", "Local server socket", "name", "")
+ , socketOption("socket", "Local server socket", "name", socketPath())
, newWindowOption("in-new-window", "Open URL in new window")
{
setApplicationDescription("yet another no-frills browser");