diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/core/dir.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/luarocks/core/dir.lua b/src/luarocks/core/dir.lua index 0da88997..46dbeafd 100644 --- a/src/luarocks/core/dir.lua +++ b/src/luarocks/core/dir.lua | |||
@@ -63,6 +63,7 @@ function dir.normalize(name) | |||
63 | if pathname:match("^.:") then | 63 | if pathname:match("^.:") then |
64 | drive, pathname = pathname:match("^(.:)(.*)$") | 64 | drive, pathname = pathname:match("^(.:)(.*)$") |
65 | end | 65 | end |
66 | pathname = pathname .. "/" | ||
66 | for piece in pathname:gmatch("(.-)/") do | 67 | for piece in pathname:gmatch("(.-)/") do |
67 | if piece == ".." then | 68 | if piece == ".." then |
68 | local prev = pieces[#pieces] | 69 | local prev = pieces[#pieces] |
@@ -75,11 +76,13 @@ function dir.normalize(name) | |||
75 | table.insert(pieces, piece) | 76 | table.insert(pieces, piece) |
76 | end | 77 | end |
77 | end | 78 | end |
78 | local basename = pathname:match("[^/]+$") | 79 | if #pieces == 0 then |
79 | if basename then | 80 | pathname = drive .. "." |
80 | table.insert(pieces, basename) | 81 | elseif #pieces == 1 and pieces[1] == "" then |
82 | pathname = drive .. "/" | ||
83 | else | ||
84 | pathname = drive .. table.concat(pieces, "/") | ||
81 | end | 85 | end |
82 | pathname = drive .. table.concat(pieces, "/") | ||
83 | if protocol ~= "file" then pathname = protocol .."://"..pathname end | 86 | if protocol ~= "file" then pathname = protocol .."://"..pathname end |
84 | return pathname | 87 | return pathname |
85 | end | 88 | end |