From 7f67011db75e671068b7f02d5489491f512bf816 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 28 Oct 2016 14:27:51 +0300 Subject: Move Unix-specific fs.Q implementation into luarocks.fs.unix --- src/luarocks/fs/lua.lua | 11 ----------- src/luarocks/fs/unix.lua | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index a31cbb4e..41711eab 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua @@ -30,17 +30,6 @@ local dir_stack = {} local dir_separator = "/" ---- Quote argument for shell processing. --- Adds single quotes and escapes. --- @param arg string: Unquoted argument. --- @return string: Quoted argument. -function fs_lua.Q(arg) - assert(type(arg) == "string") - - -- FIXME Unix-specific - return "'" .. arg:gsub("'", "'\\''") .. "'" -end - --- Test is file/dir is writable. -- Warning: testing if a file/dir is writable does not guarantee -- that it will remain writable and therefore it is no replacement diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua index 5c6b542c..e2bdc7b8 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua @@ -22,6 +22,15 @@ function unix.quiet_stderr(cmd) return cmd.." 2> /dev/null" end +--- Quote argument for shell processing. +-- Adds single quotes and escapes. +-- @param arg string: Unquoted argument. +-- @return string: Quoted argument. +function unix.Q(arg) + assert(type(arg) == "string") + return "'" .. arg:gsub("'", "'\\''") .. "'" +end + --- Return an absolute pathname from a potentially relative one. -- @param pathname string: pathname to convert. -- @param relative_to string or nil: path to prepend when making -- cgit v1.2.3-55-g6feb