From a212d87be891c5146021b6442063ed39a4a1cd4a Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 22 Apr 2025 11:09:17 +0200 Subject: Remove redundant calls to std::filesystem::absolute ...when calling std::filesystem::weakly_canonical, since the latter converts the argument path to an absolute path internally. --- src/utils/cpp/tmp_dir.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/utils/cpp/tmp_dir.cpp') diff --git a/src/utils/cpp/tmp_dir.cpp b/src/utils/cpp/tmp_dir.cpp index 9a38aca2..2a43cacd 100644 --- a/src/utils/cpp/tmp_dir.cpp +++ b/src/utils/cpp/tmp_dir.cpp @@ -49,8 +49,8 @@ auto TmpDir::CreateFile(TmpDir::Ptr const& parent, } try { - auto file_path = std::filesystem::weakly_canonical( - std::filesystem::absolute(temp_dir->GetPath() / file_name)); + auto file_path = + std::filesystem::weakly_canonical(temp_dir->GetPath() / file_name); if (not FileSystemManager::CreateFile(file_path)) { return nullptr; } @@ -75,8 +75,7 @@ auto TmpDir::CreateImpl(TmpDir::Ptr parent, std::string file_path; try { - file_path = std::filesystem::weakly_canonical( - std::filesystem::absolute(path / kDirTemplate)); + file_path = std::filesystem::weakly_canonical(path / kDirTemplate); // Create a temporary directory: if (mkdtemp(file_path.data()) == nullptr) { return nullptr; -- cgit v1.2.3