Skip to content

Commit acb287a

Browse files
committed
Do not try to remove entry parent
1 parent 945a660 commit acb287a

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/move.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ void remove(const fs::path& path) noexcept {
5959
try {
6060
std::error_code ec;
6161
fs::remove_all(path, ec);
62-
63-
fs::path parent = path.parent_path();
64-
if (!fs::equivalent(parent, fs::temp_directory_path(), ec)) {
65-
fs::remove(parent, ec);
66-
}
6762
} catch (const std::bad_alloc& ex) {
6863
static_cast<void>(ex);
6964
}

tests/directory.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <filesystem>
77
#include <fstream>
8-
#include <gmock/gmock.h>
98
#include <iterator>
109
#include <stdexcept>
1110
#include <utility>
@@ -23,7 +22,9 @@ TEST(directory, create_with_prefix) {
2322
EXPECT_TRUE(fs::exists(tmpdir));
2423
EXPECT_TRUE(fs::is_directory(tmpdir));
2524
EXPECT_TRUE(fs::equivalent(parent, fs::temp_directory_path()));
26-
EXPECT_THAT(tmpdir.path().filename(), testing::StartsWith(PREFIX));
25+
26+
fs::path::string_type filename = tmpdir.path().filename();
27+
EXPECT_EQ(filename.substr(0, std::string(PREFIX).length()), fs::path(PREFIX));
2728

2829
fs::perms permissions = fs::status(tmpdir).permissions();
2930
#ifdef _WIN32

tests/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ unit_test = executable(
66
'file.cpp',
77
dependencies: [gtest_main_dep, tmp_dep],
88
cpp_args: [
9-
'-DLABEL="com.github.bugdea1er.tmp"',
9+
'-DPREFIX="com.github.bugdea1er.tmp"',
1010
'-DBUILD_DIR="' + meson.current_build_dir() + '"',
1111
],
1212
build_by_default: false,

0 commit comments

Comments
 (0)