updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2024-08-07 20:59:13 -05:00
parent efb2be5839
commit ca97620b44
5 changed files with 31 additions and 28 deletions

View File

@ -110,28 +110,29 @@ auto file::open_file(std::filesystem::path path, bool read_only) -> file {
auto file::open_or_create_file(std::filesystem::path path,
bool read_only) -> file {
path = utils::path::absolute(path.string());
if (not utils::file::is_file(path.string())) {
#if defined(_WIN32)
int old_mode{};
_umask_s(077, &old_mode);
int old_mode{};
_umask_s(077, &old_mode);
#else // !defined(_WIN32)
auto old_mode = umask(077);
auto old_mode = umask(077);
#endif // defined(_WIN32)
#if defined(_WIN32)
auto *ptr = _fsopen(path.string().c_str(), "ab+", _SH_DENYNO);
auto *ptr = _fsopen(path.string().c_str(), "ab+", _SH_DENYNO);
#else // !defined(_WIN32)
auto *ptr = fopen(path.string().c_str(), "ab+");
auto *ptr = fopen(path.string().c_str(), "ab+");
#endif // defined(_WIN32)
#if defined(_WIN32)
_umask_s(old_mode, nullptr);
_umask_s(old_mode, nullptr);
#else // !defined(_WIN32)
umask(old_mode);
umask(old_mode);
#endif // defined(_WIN32)
if (ptr != nullptr) {
fclose(ptr);
if (ptr != nullptr) {
fclose(ptr);
}
}
return open_file(path, read_only);