diff options
| author | Dan Engelbrecht <[email protected]> | 2025-04-02 20:00:27 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-04-02 20:00:27 +0200 |
| commit | 8e9a0b2d7a386dd390ab4b23c563b994e5f79f7a (patch) | |
| tree | 8c843b0d12b52e30f325ea7ebf908ca8257efde8 /src | |
| parent | Merge pull request #319 from ue-foundation/fd-fix-binary-json (diff) | |
| download | zen-8e9a0b2d7a386dd390ab4b23c563b994e5f79f7a.tar.xz zen-8e9a0b2d7a386dd390ab4b23c563b994e5f79f7a.zip | |
upload fail mac linux (#338)
* fix macos/linux path resolving
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, {})) |