Skip to content

Commit 40ad0d7

Browse files
committed
remove redundant logic
1 parent 0d1eab0 commit 40ad0d7

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/normalize.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,12 @@ fs_drop_trailing_slash(std::string_view path)
9090
// drop trailing "/" and "\" from the path
9191
// but not if it is the root name
9292

93-
if (path.empty())
94-
return {};
95-
9693
std::string p(path);
9794

9895
while(p.length() > 1 && (p.back() == '/' || (fs_is_windows() && p.back() == '\\')))
9996
p.pop_back();
10097

101-
if (fs_is_windows() && p == fs_root_name(path))
98+
if (fs_is_windows() && !p.empty() && p == fs_root_name(path))
10299
p.push_back('/');
103100

104101
return p;

src/parent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ std::string fs_parent(std::string_view path)
5353
return ".";
5454

5555
// need this for <filesystem> or _splitpath_s to make x: x:/
56-
if (fs_is_windows() && !p.empty() && p == fs_root_name(p))
56+
if (fs_is_windows() && p == fs_root_name(p))
5757
p.push_back('/');
5858

5959
return p;

0 commit comments

Comments
 (0)