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