winfsp unit tests and fixes

This commit is contained in:
2024-10-30 14:56:50 -05:00
parent 7d74d192f9
commit 07d0eb0616
12 changed files with 227 additions and 104 deletions

View File

@@ -33,7 +33,7 @@ namespace {
file_size = 0U;
#if defined(_WIN32)
struct _stat64 st {};
struct _stat64 st{};
auto res = _stat64(std::string{path}.c_str(), &st);
if (res != 0) {
return false;
@@ -55,7 +55,7 @@ namespace {
return ((::PathFileExistsA(abs_path.c_str()) != 0) &&
(::PathIsDirectoryA(abs_path.c_str()) == 0));
#else // !defined(_WIN32)
struct stat64 st {};
struct stat64 st{};
return (stat64(abs_path.c_str(), &st) == 0 && not S_ISDIR(st.st_mode));
#endif // defined(_WIN32)
}
@@ -70,12 +70,12 @@ namespace repertory::utils::file {
// std::string path;
//
// #if defined(_WIN32)
// path.resize(repertory::max_path_length + 1);
// path.resize(repertory::max_path_length + 1U);
// ::GetFinalPathNameByHandleA(handle, path.data(),
// static_cast<DWORD>(path.size()),
// FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
// #else // !defined(_WIN32)
// path.resize(repertory::max_path_length + 1);
// path.resize(repertory::max_path_length + 1U);
//
// #if defined(__APPLE__)
// fcntl(handle, F_GETPATH, source_path.data());
@@ -155,8 +155,8 @@ auto file::open_file(std::string_view path, bool read_only) -> fs_file_t {
return new_file;
}
auto file::open_or_create_file(std::string_view path,
bool read_only) -> fs_file_t {
auto file::open_or_create_file(std::string_view path, bool read_only)
-> fs_file_t {
auto abs_path = utils::path::absolute(path);
if (not is_file(abs_path)) {
#if defined(_WIN32)