summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-01 13:10:08 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-01 13:10:08 +0000
commite42881fa380ee2f299dc00bfbc38356f7919b0d2 (patch)
tree399b34395a36ebb3796054430ca5bf279a1e7b27 /src/main.cc
parent968e573d803df664b4280ed30e22846a9b08963c (diff)
Fix remaining uses of hardcoded /tmp to get the socket paths
Fixes #1097
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.cc b/src/main.cc
index 88646230..a6e81f30 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -761,8 +761,10 @@ int main(int argc, char* argv[])
const bool clear_sessions = (bool)parser.get_switch("clear");
if (list_sessions or clear_sessions)
{
- StringView username = getpwuid(geteuid())->pw_name;
- for (auto& session : list_files(format("/tmp/kakoune/{}/", username)))
+ const StringView username = getpwuid(geteuid())->pw_name;
+ const StringView tmp_dir = tmpdir();
+ for (auto& session : list_files(format("{}/kakoune/{}/", tmp_dir,
+ username)))
{
const bool valid = check_session(session);
if (list_sessions)
@@ -770,7 +772,8 @@ int main(int argc, char* argv[])
if (not valid and clear_sessions)
{
char socket_file[128];
- format_to(socket_file, "/tmp/kakoune/{}/{}", username, session);
+ format_to(socket_file, "{}/kakoune/{}/{}", tmp_dir,
+ username, session);
unlink(socket_file);
}
}