From a47e94ebd525924e22627afb60746ebf983eb81e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Sun, 18 Oct 2020 01:42:19 +0200 Subject: [PATCH] Fix of #4889 (malfunctioning single instance detection on macOS): This was hapenning because the datadir did not exist yet, which was interpreted as another instance running. --- src/slic3r/GUI/InstanceCheck.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/slic3r/GUI/InstanceCheck.cpp b/src/slic3r/GUI/InstanceCheck.cpp index b19d5c84d..4aaecd2b2 100644 --- a/src/slic3r/GUI/InstanceCheck.cpp +++ b/src/slic3r/GUI/InstanceCheck.cpp @@ -11,6 +11,7 @@ #include "boost/nowide/convert.hpp" #include +#include #include #include #include @@ -136,6 +137,13 @@ namespace instance_check_internal fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 1; + + if (! boost::filesystem::is_directory(path)) { + BOOST_LOG_TRIVIAL(debug) << "get_lock(): datadir does not exist yet, creating..."; + if (! boost::filesystem::create_directories(path)) + BOOST_LOG_TRIVIAL(debug) << "get_lock(): unable to create datadir !!!"; + } + if ((fdlock = open(dest_dir.c_str(), O_WRONLY | O_CREAT, 0666)) == -1) return true;