aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/copy_cmd.cpp
diff options
context:
space:
mode:
authorFlorent Devillechabrol <[email protected]>2025-04-02 10:38:02 -0700
committerGitHub Enterprise <[email protected]>2025-04-02 10:38:02 -0700
commit486a22ad2c61bc1616d8745e0077eb320089bfec (patch)
tree665d5c9002cd97c04ddffeaf211fcf8e55d01dce /src/zen/cmds/copy_cmd.cpp
parentFixed missing trailing quote when converting binary data from compact binary ... (diff)
parentadded --find-max-block-count option to builds upload (#337) (diff)
downloadarchived-zen-486a22ad2c61bc1616d8745e0077eb320089bfec.tar.xz
archived-zen-486a22ad2c61bc1616d8745e0077eb320089bfec.zip
Merge branch 'main' into fd-fix-binary-json
Diffstat (limited to 'src/zen/cmds/copy_cmd.cpp')
-rw-r--r--src/zen/cmds/copy_cmd.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/zen/cmds/copy_cmd.cpp b/src/zen/cmds/copy_cmd.cpp
index cc6ddd505..53e80c896 100644
--- a/src/zen/cmds/copy_cmd.cpp
+++ b/src/zen/cmds/copy_cmd.cpp
@@ -64,8 +64,8 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
}
- const bool IsFileCopy = std::filesystem::is_regular_file(m_CopySource);
- const bool IsDirCopy = std::filesystem::is_directory(m_CopySource);
+ const bool IsFileCopy = IsFile(m_CopySource);
+ const bool IsDirCopy = IsDir(m_CopySource);
if (!IsFileCopy && !IsDirCopy)
{
@@ -79,20 +79,14 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (IsDirCopy)
{
- if (std::filesystem::exists(ToPath))
+ if (IsFile(ToPath))
{
- const bool IsTargetDir = std::filesystem::is_directory(ToPath);
- if (!IsTargetDir)
- {
- if (std::filesystem::is_regular_file(ToPath))
- {
- throw std::runtime_error("Attempted copy of directory into file");
- }
- }
+ throw std::runtime_error("Attempted copy of directory into file");
}
- else
+
+ if (!IsDir(ToPath))
{
- std::filesystem::create_directories(ToPath);
+ CreateDirectories(ToPath);
}
std::filesystem::path ToCanonical = std::filesystem::canonical(ToPath, Ec);