aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-03-31 10:24:39 +0200
committerGitHub Enterprise <[email protected]>2025-03-31 10:24:39 +0200
commitfd2efb5af872a357dbc0f729f4101a330dcb4fda (patch)
tree949e933156467113b861f4b0ca5862f9cdf10189 /src/zenstore/compactcas.cpp
parentcheck file from local track state during download (#329) (diff)
downloadzen-fd2efb5af872a357dbc0f729f4101a330dcb4fda.tar.xz
zen-fd2efb5af872a357dbc0f729f4101a330dcb4fda.zip
long filename support (#330)
- Bugfix: Long file paths now works correctly on Windows
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index b64bc26dd..184251da7 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -927,10 +927,10 @@ CasContainerStrategy::MakeIndexSnapshot()
fs::path TempIndexPath = cas::impl::GetTempIndexPath(m_RootDirectory, m_ContainerBaseName);
// Move index away, we keep it if something goes wrong
- if (fs::is_regular_file(TempIndexPath))
+ if (IsFile(TempIndexPath))
{
std::error_code Ec;
- if (!fs::remove(TempIndexPath, Ec) || Ec)
+ if (!RemoveFile(TempIndexPath, Ec) || Ec)
{
ZEN_WARN("snapshot failed to clean up temp snapshot at {}, reason: '{}'", TempIndexPath, Ec.message());
return;
@@ -939,9 +939,9 @@ CasContainerStrategy::MakeIndexSnapshot()
try
{
- if (fs::is_regular_file(IndexPath))
+ if (IsFile(IndexPath))
{
- fs::rename(IndexPath, TempIndexPath);
+ RenameFile(IndexPath, TempIndexPath);
}
// Write the current state of the location map to a new index state
@@ -992,21 +992,21 @@ CasContainerStrategy::MakeIndexSnapshot()
// Restore any previous snapshot
- if (fs::is_regular_file(TempIndexPath))
+ if (IsFile(TempIndexPath))
{
std::error_code Ec;
- fs::remove(IndexPath, Ec); // We don't care if this fails, we try to move the old temp file regardless
- fs::rename(TempIndexPath, IndexPath, Ec);
+ RemoveFile(IndexPath, Ec); // We don't care if this fails, we try to move the old temp file regardless
+ RenameFile(TempIndexPath, IndexPath, Ec);
if (Ec)
{
ZEN_WARN("snapshot failed to restore old snapshot from {}, reason: '{}'", TempIndexPath, Ec.message());
}
}
}
- if (fs::is_regular_file(TempIndexPath))
+ if (IsFile(TempIndexPath))
{
std::error_code Ec;
- if (!fs::remove(TempIndexPath, Ec) || Ec)
+ if (!RemoveFile(TempIndexPath, Ec) || Ec)
{
ZEN_WARN("snapshot failed to remove temporary file {}, reason: '{}'", TempIndexPath, Ec.message());
}
@@ -1092,7 +1092,7 @@ CasContainerStrategy::ReadLog(const std::filesystem::path& LogPath, uint64_t Ski
if (!TCasLogFile<CasDiskIndexEntry>::IsValid(LogPath))
{
ZEN_WARN("removing invalid cas log at '{}'", LogPath);
- std::filesystem::remove(LogPath);
+ RemoveFile(LogPath);
return 0;
}
@@ -1155,7 +1155,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
if (IsNewStore)
{
- std::filesystem::remove_all(BasePath);
+ DeleteDirectories(BasePath);
}
CreateDirectories(BasePath);
@@ -1165,19 +1165,19 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
std::filesystem::path LogPath = cas::impl::GetLogPath(m_RootDirectory, m_ContainerBaseName);
std::filesystem::path IndexPath = cas::impl::GetIndexPath(m_RootDirectory, m_ContainerBaseName);
- if (std::filesystem::is_regular_file(IndexPath))
+ if (IsFile(IndexPath))
{
uint32_t IndexVersion = 0;
m_LogFlushPosition = ReadIndexFile(IndexPath, IndexVersion);
if (IndexVersion == 0)
{
ZEN_WARN("removing invalid index file at '{}'", IndexPath);
- std::filesystem::remove(IndexPath);
+ RemoveFile(IndexPath);
}
}
uint64_t LogEntryCount = 0;
- if (std::filesystem::is_regular_file(LogPath))
+ if (IsFile(LogPath))
{
if (TCasLogFile<CasDiskIndexEntry>::IsValid(LogPath))
{
@@ -1186,7 +1186,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore)
else
{
ZEN_WARN("removing invalid cas log at '{}'", LogPath);
- std::filesystem::remove(LogPath);
+ RemoveFile(LogPath);
}
}