diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2024-03-18 16:58:55 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-22 11:57:33 +0000 |
commit | 8da4b9161c19a8d29112a516b8ede637afac037f (patch) | |
tree | ceb785c420f512bf6fde58f6ea9f87a2a7ade773 /src | |
parent | 887f2595afd217e9f28b466a400bd60e9e34ceba (diff) |
Add the error output for syncqt normilizedPath function
Task-number: QTBUG-123438
Pick-to: 6.5
Change-Id: If718d774daac2fd4a9e27ad4725a74362d1c78f3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7aecb189d544613ad13c7e7d1207bd7767225a71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1e3c0e43953c89e16eb6275f9bac799d9cbf5ddf)
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/syncqt/main.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp index ac93d659c2..6f29ad5330 100644 --- a/src/tools/syncqt/main.cpp +++ b/src/tools/syncqt/main.cpp @@ -135,17 +135,24 @@ void printInternalError() << std::endl; } -std::filesystem::path normilizedPath(const std::string &path) -{ - return std::filesystem::path(std::filesystem::weakly_canonical(path).generic_string()); -} - void printFilesystemError(const std::filesystem::filesystem_error &fserr, std::string_view errorMsg) { std::cerr << errorMsg << ": " << fserr.path1() << ".\n" << fserr.what() << "(" << fserr.code().value() << ")" << std::endl; } +std::filesystem::path normilizedPath(const std::string &path) +{ + try { + auto result = std::filesystem::path(std::filesystem::weakly_canonical(path).generic_string()); + return result; + } catch (const std::filesystem::filesystem_error &fserr) { + printFilesystemError(fserr, "Unable to normalize path"); + throw; + } + return {}; +} + bool createDirectories(const std::string &path, std::string_view errorMsg, bool *exists = nullptr) { bool result = true; |