Path: blob/main/cad/OrcaSlicer/files/patch-src_libslic3r_utils.cpp
34610 views
--- src/libslic3r/utils.cpp.orig 2025-10-02 17:32:12 UTC1+++ src/libslic3r/utils.cpp2@@ -41,6 +41,11 @@3#include <dirent.h>4#include <stdio.h>5#endif6+ #ifdef __FreeBSD__7+ #include <sys/stat.h>8+ #include <dirent.h>9+ #include <stdio.h>10+ #endif11#endif1213#include <boost/log/core.hpp>14@@ -847,7 +852,7 @@ CopyFileResult copy_file_inner(const std::string& from15// That may happen when copying on some exotic file system, for example Linux on Chrome.16copy_file_linux(source, target, ec);17#else // __linux__18- boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec);19+ boost::filesystem::copy_file(source, target, boost::filesystem::copy_options::overwrite_existing, ec);20#endif // __linux__21if (ec) {22error_message = ec.message();23@@ -1205,6 +1210,12 @@ std::string get_process_name(int pid)24char* p = pathbuf;25while (auto q = strchr(p + 1, '/')) p = q;26return p;27+#elif defined(__FreeBSD__)28+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };29+ char pathbuf[PATH_MAX];30+ size_t cb = sizeof(pathbuf);31+ if (sysctl(mib, 4, pathbuf, &cb, NULL, 0) != 0) return std::string();32+ return boost::filesystem::path(pathbuf).filename().string();33#else34char pathbuf[512] = {0};35char proc_path[32] = "/proc/self/exe";36@@ -1484,7 +1495,7 @@ bool makedir(const std::string path) {37#ifdef WIN3238if (_access(path.c_str(), 0) != 0)39return _mkdir(path.c_str()) == 0;40-#elif __linux__41+#elif defined(__linux__) || defined(__FreeBSD__)42if (opendir(path.c_str()) == NULL) {43return mkdir(path.c_str(), 0777) == 0;44}454647