diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-03-05 22:13:12 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-03-06 15:14:36 +0000 |
commit | 8d30fc5bd2b352897b81756400ab50d2be859209 (patch) | |
tree | f71fe388bf942a8675b011e377c55587da2133f0 /src | |
parent | c3345ac3c416d5f0eb229258262b112f33bf0441 (diff) | |
download | luarocks-8d30fc5bd2b352897b81756400ab50d2be859209.tar.gz luarocks-8d30fc5bd2b352897b81756400ab50d2be859209.tar.bz2 luarocks-8d30fc5bd2b352897b81756400ab50d2be859209.zip |
fix(windows): output native slashes on fs.find
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/build/builtin.lua | 7 | ||||
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index c55b61a0..4c15d2bf 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -8,6 +8,7 @@ local builtin = {} | |||
8 | builtin.skip_lua_inc_lib_check = true | 8 | builtin.skip_lua_inc_lib_check = true |
9 | 9 | ||
10 | local unpack = unpack or table.unpack | 10 | local unpack = unpack or table.unpack |
11 | local dir_sep = package.config:sub(1, 1) | ||
11 | 12 | ||
12 | local fs = require("luarocks.fs") | 13 | local fs = require("luarocks.fs") |
13 | local path = require("luarocks.path") | 14 | local path = require("luarocks.path") |
@@ -59,7 +60,7 @@ do | |||
59 | for _, parent in ipairs({"src", "lua", "lib"}) do | 60 | for _, parent in ipairs({"src", "lua", "lib"}) do |
60 | if fs.is_dir(parent) then | 61 | if fs.is_dir(parent) then |
61 | fs.change_dir(parent) | 62 | fs.change_dir(parent) |
62 | prefix = parent.."/" | 63 | prefix = parent .. dir_sep |
63 | break | 64 | break |
64 | end | 65 | end |
65 | end | 66 | end |
@@ -69,7 +70,7 @@ do | |||
69 | if not skiplist[base] then | 70 | if not skiplist[base] then |
70 | local luamod = file:match("(.*)%.lua$") | 71 | local luamod = file:match("(.*)%.lua$") |
71 | if luamod then | 72 | if luamod then |
72 | modules[path.path_to_module(file)] = prefix..file | 73 | modules[path.path_to_module(file)] = prefix .. file |
73 | else | 74 | else |
74 | local cmod = file:match("(.*)%.c$") | 75 | local cmod = file:match("(.*)%.c$") |
75 | if cmod then | 76 | if cmod then |
@@ -89,7 +90,7 @@ do | |||
89 | fs.pop_dir() | 90 | fs.pop_dir() |
90 | end | 91 | end |
91 | 92 | ||
92 | local bindir = (fs.is_dir("src/bin") and "src/bin") | 93 | local bindir = (fs.is_dir(dir.path("src", "bin")) and dir.path("src", "bin")) |
93 | or (fs.is_dir("bin") and "bin") | 94 | or (fs.is_dir("bin") and "bin") |
94 | if bindir then | 95 | if bindir then |
95 | install = { bin = {} } | 96 | install = { bin = {} } |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index be63063b..86cbb45b 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -10,6 +10,8 @@ local cfg = require("luarocks.core.cfg") | |||
10 | 10 | ||
11 | local vars = setmetatable({}, { __index = function(_,k) return cfg.variables[k] end }) | 11 | local vars = setmetatable({}, { __index = function(_,k) return cfg.variables[k] end }) |
12 | 12 | ||
13 | local dir_sep = package.config:sub(1, 1) | ||
14 | |||
13 | --- Adds prefix to command to make it run from a directory. | 15 | --- Adds prefix to command to make it run from a directory. |
14 | -- @param directory string: Path to a directory. | 16 | -- @param directory string: Path to a directory. |
15 | -- @param cmd string: A command-line string. | 17 | -- @param cmd string: A command-line string. |
@@ -132,7 +134,7 @@ function tools.find(at) | |||
132 | local first_two = file:sub(1,2) | 134 | local first_two = file:sub(1,2) |
133 | if first_two == ".\\" or first_two == "./" then file=file:sub(3) end | 135 | if first_two == ".\\" or first_two == "./" then file=file:sub(3) end |
134 | if file ~= "." then | 136 | if file ~= "." then |
135 | table.insert(result, (file:gsub("\\", "/"))) | 137 | table.insert(result, (file:gsub("[\\/]", dir_sep))) |
136 | end | 138 | end |
137 | end | 139 | end |
138 | pipe:close() | 140 | pipe:close() |