aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/workspaces.cpp
diff options
context:
space:
mode:
authorzousar <[email protected]>2025-06-24 16:26:29 -0600
committerzousar <[email protected]>2025-06-24 16:26:29 -0600
commitbb298631ba35a323827dda0b8cd6158e276b5f61 (patch)
tree7ba8db91c44ce83f2c518f80f80ab14910eefa6f /src/zenstore/workspaces.cpp
parentChange to PutResult structure (diff)
parent5.6.14 (diff)
downloadzen-bb298631ba35a323827dda0b8cd6158e276b5f61.tar.xz
zen-bb298631ba35a323827dda0b8cd6158e276b5f61.zip
Merge branch 'main' into zs/put-overwrite-policy
Diffstat (limited to 'src/zenstore/workspaces.cpp')
-rw-r--r--src/zenstore/workspaces.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp
index 02a83d2a6..0ca2adab2 100644
--- a/src/zenstore/workspaces.cpp
+++ b/src/zenstore/workspaces.cpp
@@ -444,7 +444,7 @@ Workspaces::RefreshWorkspaceShares(const Oid& WorkspaceId)
{
const std::filesystem::path& RootPath = Workspace->GetConfig().RootPath;
std::filesystem::path ConfigPath = RootPath / WorkspaceConfigName;
- if (std::filesystem::exists(ConfigPath))
+ if (IsFile(ConfigPath))
{
std::string Error;
std::vector<Workspaces::WorkspaceShareConfiguration> WorkspaceShares = ReadWorkspaceConfig(m_Log, RootPath, Error);
@@ -458,7 +458,7 @@ Workspaces::RefreshWorkspaceShares(const Oid& WorkspaceId)
{
const std::filesystem::path& SharePath = Configuration.SharePath;
- if (std::filesystem::is_directory(RootPath / SharePath))
+ if (IsDir(RootPath / SharePath))
{
DeletedShares.erase(Configuration.Id);
@@ -808,7 +808,7 @@ Workspaces::ReadConfig(const LoggerRef& InLog, const std::filesystem::path& Work
ZEN_DEBUG("Reading workspaces state from {}", WorkspaceStatePath);
const std::filesystem::path ConfigPath = WorkspaceStatePath / WorkspacesConfigName;
- if (std::filesystem::exists(ConfigPath))
+ if (IsFile(ConfigPath))
{
std::vector<Workspaces::WorkspaceConfiguration> Workspaces =
WorkspacesFromJson(IoBufferBuilder::MakeFromFile(ConfigPath), OutError);
@@ -847,7 +847,7 @@ Workspaces::ReadWorkspaceConfig(const LoggerRef& InLog, const std::filesystem::p
ZEN_DEBUG("Reading workspace state from {}", WorkspaceRoot);
std::filesystem::path ConfigPath = WorkspaceRoot / WorkspaceConfigName;
- if (std::filesystem::exists(ConfigPath))
+ if (IsFile(ConfigPath))
{
std::vector<Workspaces::WorkspaceShareConfiguration> WorkspaceShares =
WorkspaceSharesFromJson(IoBufferBuilder::MakeFromFile(ConfigPath), OutError);
@@ -886,7 +886,7 @@ Workspaces::AddWorkspace(const LoggerRef& Log, const std::filesystem::path& Work
{
throw std::invalid_argument(fmt::format("invalid root path '{}' for workspace {}", Configuration.RootPath, Configuration.Id));
}
- if (!std::filesystem::is_directory(Configuration.RootPath))
+ if (!IsDir(Configuration.RootPath))
{
throw std::invalid_argument(
fmt::format("workspace root path '{}' does not exist for workspace '{}'", Configuration.RootPath, Configuration.Id));
@@ -965,7 +965,7 @@ Workspaces::AddWorkspaceShare(const LoggerRef& Log,
throw std::invalid_argument(
fmt::format("workspace share path '{}' is not a sub-path of workspace path '{}'", Configuration.SharePath, WorkspaceRoot));
}
- if (!std::filesystem::is_directory(WorkspaceRoot / Configuration.SharePath))
+ if (!IsDir(WorkspaceRoot / Configuration.SharePath))
{
throw std::invalid_argument(
fmt::format("workspace share path '{}' does not exist in workspace path '{}'", Configuration.SharePath, WorkspaceRoot));
@@ -1244,7 +1244,7 @@ Workspaces::FindWorkspaceShare(const Oid& WorkspaceId, const Oid& ShareId, bool
const Workspaces::WorkspaceConfiguration& WorkspaceConfig = Workspace->GetConfig();
const Workspaces::WorkspaceShareConfiguration& ShareConfig = Share->GetConfig();
std::filesystem::path FullSharePath = WorkspaceConfig.RootPath / ShareConfig.SharePath;
- if (std::filesystem::is_directory(FullSharePath))
+ if (IsDir(FullSharePath))
{
if (ForceRefresh || !Share->IsInitialized())
{
@@ -1306,18 +1306,18 @@ namespace {
std::filesystem::path EmptyFolder(RootPath / "empty_folder");
std::filesystem::path FirstFolder(RootPath / "first_folder");
- std::filesystem::create_directory(FirstFolder);
+ CreateDirectories(FirstFolder);
Result.push_back(std::make_pair(FirstFolder / "first_folder_blob1.bin", CreateRandomBlob(22)));
Result.push_back(std::make_pair(FirstFolder / "first_folder_blob2.bin", CreateRandomBlob(122)));
std::filesystem::path SecondFolder(RootPath / "second_folder");
- std::filesystem::create_directory(SecondFolder);
+ CreateDirectories(SecondFolder);
Result.push_back(std::make_pair(SecondFolder / "second_folder_blob1.bin", CreateRandomBlob(522)));
Result.push_back(std::make_pair(SecondFolder / "second_folder_blob2.bin", CreateRandomBlob(122)));
Result.push_back(std::make_pair(SecondFolder / "second_folder_blob3.bin", CreateRandomBlob(225)));
std::filesystem::path SecondFolderChild(SecondFolder / "child_in_second");
- std::filesystem::create_directory(SecondFolderChild);
+ CreateDirectories(SecondFolderChild);
Result.push_back(std::make_pair(SecondFolderChild / "second_child_folder_blob1.bin", CreateRandomBlob(622)));
for (const auto& It : Result)
@@ -1365,13 +1365,13 @@ TEST_CASE("workspaces.scanfolder")
Structure->IterateEntries([&](const Oid& Id, const FolderStructure::FileEntry& Entry) {
std::filesystem::path AbsPath = RootPath / Entry.RelativePath;
- CHECK(std::filesystem::is_regular_file(AbsPath));
- CHECK(std::filesystem::file_size(AbsPath) == Entry.Size);
+ CHECK(IsFile(AbsPath));
+ CHECK(FileSizeFromPath(AbsPath) == Entry.Size);
const FolderStructure::FileEntry* FindEntry = Structure->FindEntry(Id);
CHECK(FindEntry);
std::filesystem::path Path = RootPath / FindEntry->RelativePath;
CHECK(AbsPath == Path);
- CHECK(std::filesystem::file_size(AbsPath) == FindEntry->Size);
+ CHECK(FileSizeFromPath(AbsPath) == FindEntry->Size);
});
}