Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/tmp/directory
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public:
}

/// Returns the path of this directory
/// @returns The full path of this directory
/// @returns The canonical path of this directory
operator const std::filesystem::path&() const noexcept {
return pathobject;
}

/// Returns the path of this directory
/// @returns The full path of this directory
/// @returns The canonical path of this directory
const std::filesystem::path& path() const noexcept {
return pathobject;
}
Expand Down
2 changes: 1 addition & 1 deletion src/create_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ fs::path create_directory(std::string_view prefix) {
throw fs::filesystem_error("Cannot create a temporary directory", ec);
}

return path;
return fs::canonical(path);
}
} // namespace tmp::detail
2 changes: 2 additions & 0 deletions tests/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ TEST(directory, create_with_prefix) {
EXPECT_TRUE(fs::is_directory(tmpdir));
EXPECT_TRUE(fs::equivalent(parent, fs::temp_directory_path()));

EXPECT_EQ(fs::canonical(tmpdir), tmpdir.path());

#ifdef _WIN32
constexpr std::wstring_view actual_prefix = L"com.github.bugdea1er.tmp.";
#else
Expand Down