Skip to content

Commit

Permalink
Merge pull request #10 from tuist/fix-basename
Browse files Browse the repository at this point in the history
Fix `AbsolutePath.basename` returning an invalid value.
  • Loading branch information
pepicrft authored Jun 7, 2024
2 parents 640861d + 5215e91 commit 4490da6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Path/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ extension Path {
// FIXME: This method seems too complicated; it should be simplified,
// if possible, and certainly optimized (using UTF8View).
// Check for a special case of the root directory.
if string.first == "/" {
if ((string.count == 1) ? string[string.startIndex] : nil) == "/" {
// Root directory, so the basename is a single path separator (the
// root directory is special in this regard).
return "/"
Expand Down

0 comments on commit 4490da6

Please sign in to comment.