aboutsummaryrefslogtreecommitdiff
path: root/zen/cmds/copy.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-15 19:49:20 +0200
committerStefan Boberg <[email protected]>2021-09-15 19:49:20 +0200
commit83ccd52321a23c8f1c8a3228cbbf34b8f199a22b (patch)
tree9cf1fb68651f616aef2fa28000e4f328ef9204d8 /zen/cmds/copy.cpp
parentAdded GetSize/GetData functions to reduce cognitive load and bridge the gap b... (diff)
parentTweaked logging to streamline access, and simplified setup code for new loggers (diff)
downloadarchived-zen-83ccd52321a23c8f1c8a3228cbbf34b8f199a22b.tar.xz
archived-zen-83ccd52321a23c8f1c8a3228cbbf34b8f199a22b.zip
Merge branch 'main' into cbpackage-update
Diffstat (limited to 'zen/cmds/copy.cpp')
-rw-r--r--zen/cmds/copy.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/zen/cmds/copy.cpp b/zen/cmds/copy.cpp
index 571a9e092..4ce09c982 100644
--- a/zen/cmds/copy.cpp
+++ b/zen/cmds/copy.cpp
@@ -3,11 +3,10 @@
#include "copy.h"
#include <zencore/filesystem.h>
+#include <zencore/logging.h>
#include <zencore/string.h>
#include <zencore/timer.h>
-#include <spdlog/spdlog.h>
-
CopyCommand::CopyCommand()
{
m_Options.add_options()("h,help", "Print help");
@@ -38,10 +37,10 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
// Validate arguments
if (m_CopySource.empty())
- throw std::exception("No source specified");
+ throw std::runtime_error("No source specified");
if (m_CopyTarget.empty())
- throw std::exception("No target specified");
+ throw std::runtime_error("No target specified");
std::filesystem::path FromPath;
std::filesystem::path ToPath;
@@ -54,12 +53,12 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (!IsFileCopy && !IsDirCopy)
{
- throw std::exception("Invalid source specification (neither directory nor file)");
+ throw std::runtime_error("Invalid source specification (neither directory nor file)");
}
if (IsFileCopy && IsDirCopy)
{
- throw std::exception("Invalid source specification (both directory AND file!?)");
+ throw std::runtime_error("Invalid source specification (both directory AND file!?)");
}
if (IsDirCopy)
@@ -71,7 +70,7 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (std::filesystem::is_regular_file(ToPath))
{
- throw std::exception("Attempted copy of directory into file");
+ throw std::runtime_error("Attempted copy of directory into file");
}
}
}
@@ -90,7 +89,7 @@ CopyCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
CopyOptions.EnableClone = !m_NoClone;
zen::CopyFile(FromPath, ToPath, CopyOptions);
- spdlog::info("Copy completed in {}", zen::NiceTimeSpanMs(Timer.getElapsedTimeMs()));
+ ZEN_INFO("Copy completed in {}", zen::NiceTimeSpanMs(Timer.getElapsedTimeMs()));
}
return 0;