Fixed build on FreeBSD

pull/13239/head
Bram 6 years ago
parent 45d2e18808
commit 724620b476
  1. 10
      modules/core/src/utils/filesystem.cpp

@ -34,7 +34,7 @@
#include <errno.h> #include <errno.h>
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -178,7 +178,7 @@ cv::String getcwd()
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data()); sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
return cv::String(buf.data(), (size_t)sz); return cv::String(buf.data(), (size_t)sz);
#endif #endif
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
for(;;) for(;;)
{ {
char* p = ::getcwd(buf.data(), buf.size()); char* p = ::getcwd(buf.data(), buf.size());
@ -212,7 +212,7 @@ bool createDirectory(const cv::String& path)
#else #else
int result = _mkdir(path.c_str()); int result = _mkdir(path.c_str());
#endif #endif
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
int result = mkdir(path.c_str(), 0777); int result = mkdir(path.c_str(), 0777);
#else #else
int result = -1; int result = -1;
@ -327,7 +327,7 @@ private:
Impl& operator=(const Impl&); // disabled Impl& operator=(const Impl&); // disabled
}; };
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
struct FileLock::Impl struct FileLock::Impl
{ {
@ -441,7 +441,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
default_cache_path = "/tmp/"; default_cache_path = "/tmp/";
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path); CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
} }
#elif defined __linux__ || defined __HAIKU__ #elif defined __linux__ || defined __HAIKU__ || defined __FreeBSD__
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if (default_cache_path.empty()) if (default_cache_path.empty())
{ {

Loading…
Cancel
Save