diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 8e8fd480a..ba2564fad 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -164,9 +164,9 @@ namespace { ); - std::filesystem::path MakeSafeAbsolutePath(const std::string Path) + std::filesystem::path MakeSafeAbsolutePath(std::filesystem::path Path) { - std::filesystem::path AbsolutePath = std::filesystem::absolute(StringToPath(Path)).make_preferred(); + std::filesystem::path AbsolutePath = std::filesystem::absolute(Path).make_preferred(); #if ZEN_PLATFORM_WINDOWS && 1 const std::string_view Prefix = "\\\\?\\"; const std::u8string PrefixU8(Prefix.begin(), Prefix.end()); @@ -180,6 +180,8 @@ namespace { return AbsolutePath; } + std::filesystem::path MakeSafeAbsolutePath(const std::string PathString) { return MakeSafeAbsolutePath(StringToPath(PathString)); } + void RenameFileWithRetry(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath) { std::error_code Ec; @@ -9061,8 +9063,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - const std::filesystem::path ZenFolderPath = - m_ZenFolderPath.empty() ? MakeSafeAbsolutePath(".") / ZenFolderName : MakeSafeAbsolutePath(m_ZenFolderPath); + const std::filesystem::path ZenFolderPath = m_ZenFolderPath.empty() + ? MakeSafeAbsolutePath(std::filesystem::current_path()) / ZenFolderName + : MakeSafeAbsolutePath(m_ZenFolderPath); CreateDirectories(ZenFolderPath); auto _ = MakeGuard([ZenFolderPath]() { if (CleanDirectory(ZenFolderPath, {})) @@ -9176,8 +9179,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - const std::filesystem::path ZenFolderPath = - m_ZenFolderPath.empty() ? MakeSafeAbsolutePath(".") / ZenFolderName : MakeSafeAbsolutePath(m_ZenFolderPath); + const std::filesystem::path ZenFolderPath = m_ZenFolderPath.empty() + ? MakeSafeAbsolutePath(std::filesystem::current_path()) / ZenFolderName + : MakeSafeAbsolutePath(m_ZenFolderPath); CreateDirectories(ZenFolderPath); auto _ = MakeGuard([ZenFolderPath]() { if (CleanDirectory(ZenFolderPath, {})) @@ -9227,7 +9231,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) m_BuildPartName, Path, ZenFolderPath, - MakeSafeAbsolutePath(m_ManifestPath), + m_ManifestPath.empty() ? std::filesystem::path{} : MakeSafeAbsolutePath(m_ManifestPath), m_FindBlockMaxCount, m_BlockReuseMinPercentLimit, m_AllowMultiparts, @@ -9777,8 +9781,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - const std::filesystem::path ZenFolderPath = - m_ZenFolderPath.empty() ? MakeSafeAbsolutePath(".") / ZenFolderName : MakeSafeAbsolutePath(m_ZenFolderPath); + const std::filesystem::path ZenFolderPath = m_ZenFolderPath.empty() + ? MakeSafeAbsolutePath(std::filesystem::current_path()) / ZenFolderName + : MakeSafeAbsolutePath(m_ZenFolderPath); CreateDirectories(ZenFolderPath); auto _ = MakeGuard([ZenFolderPath]() { if (CleanDirectory(ZenFolderPath, {})) @@ -9828,8 +9833,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) BuildStorage::Statistics StorageStats; BuildStorageCache::Statistics StorageCacheStats; - const std::filesystem::path ZenFolderPath = - m_ZenFolderPath.empty() ? MakeSafeAbsolutePath(".") / ZenFolderName : MakeSafeAbsolutePath(m_ZenFolderPath); + const std::filesystem::path ZenFolderPath = m_ZenFolderPath.empty() + ? MakeSafeAbsolutePath(std::filesystem::current_path()) / ZenFolderName + : MakeSafeAbsolutePath(m_ZenFolderPath); CreateDirectories(ZenFolderPath); auto _ = MakeGuard([ZenFolderPath]() { if (CleanDirectory(ZenFolderPath, {})) |