diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/fs/win32/tools.lua | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index f112ea3e..aa405e14 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
| @@ -11,17 +11,6 @@ local cfg = require("luarocks.cfg") | |||
| 11 | 11 | ||
| 12 | local vars = cfg.variables | 12 | local vars = cfg.variables |
| 13 | 13 | ||
| 14 | --- Strip the last extension of a filename. | ||
| 15 | -- Example: "foo.tar.gz" becomes "foo.tar". | ||
| 16 | -- If filename has no dots, returns it unchanged. | ||
| 17 | -- @param filename string: The file name to strip. | ||
| 18 | -- @return string: The stripped name. | ||
| 19 | local function strip_extension(filename) | ||
| 20 | assert(type(filename) == "string") | ||
| 21 | |||
| 22 | return (filename:gsub("%.[^.]+$", "")) or filename | ||
| 23 | end | ||
| 24 | |||
| 25 | local function command_at(directory, cmd) | 14 | local function command_at(directory, cmd) |
| 26 | local drive = directory:match("^([A-Za-z]:)") | 15 | local drive = directory:match("^([A-Za-z]:)") |
| 27 | cmd = "cd " .. fs.Q(directory) .. " & " .. cmd | 16 | cmd = "cd " .. fs.Q(directory) .. " & " .. cmd |
| @@ -195,6 +184,16 @@ function tools.is_file(file) | |||
| 195 | return fs.execute(fs.Q(vars.TEST).." -f", file) | 184 | return fs.execute(fs.Q(vars.TEST).." -f", file) |
| 196 | end | 185 | end |
| 197 | 186 | ||
| 187 | --- Strip the last extension of a filename. | ||
| 188 | -- Example: "foo.tar.gz" becomes "foo.tar". | ||
| 189 | -- If filename has no dots, returns it unchanged. | ||
| 190 | -- @param filename string: The file name to strip. | ||
| 191 | -- @return string: The stripped name. | ||
| 192 | local function strip_extension(filename) | ||
| 193 | assert(type(filename) == "string") | ||
| 194 | return (filename:gsub("%.[^.]+$", "")) or filename | ||
| 195 | end | ||
| 196 | |||
| 198 | --- Uncompress gzip file. | 197 | --- Uncompress gzip file. |
| 199 | -- @param archive string: Filename of archive. | 198 | -- @param archive string: Filename of archive. |
| 200 | -- @return boolean : success status | 199 | -- @return boolean : success status |
