diff options
author | Sebastian Thomschke <sebthom@users.noreply.github.com> | 2017-10-04 16:05:00 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-10-04 11:05:00 -0300 |
commit | 100c18d048936b5a47f29f55e6ce8b24277fb70f (patch) | |
tree | c8fab6823d37794ea409696263fc0a1e0f25138c | |
parent | d8a34f03982522170d2e5463194530186e67038b (diff) | |
download | luarocks-100c18d048936b5a47f29f55e6ce8b24277fb70f.tar.gz luarocks-100c18d048936b5a47f29f55e6ce8b24277fb70f.tar.bz2 luarocks-100c18d048936b5a47f29f55e6ce8b24277fb70f.zip |
Fix detection of directories on Windows
Function tools.delete performs a test to determine if a path is a file or a directory to select the appropriate delete command rmdir vs del.
The current test however results in rmdir being used on files too, which then results in a build abortion with error "The directory name is invalid.".
E.g.
if exist "c:\luarocks\share\lua\5.2\luasocket_3_0rc1_2-socket.lua\" ( echo "I am a folder" ) else ( echo "I am a file" )
wrongly prints "I am a folder" (tested on Windows 10)
Whereas
if exist "c:\luarocks\share\lua\5.2\luasocket_3_0rc1_2-socket.lua\*" ( echo "I am a folder" ) else ( echo "I am a file" )
correctly prints "I am a file" (tested on Windows 10)
This fixes #670
(Also see https://stackoverflow.com/a/1466528/1793220 )
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 7f6b853e..7929fdec 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -93,7 +93,7 @@ end | |||
93 | function tools.delete(arg) | 93 | function tools.delete(arg) |
94 | assert(arg) | 94 | assert(arg) |
95 | assert(arg:match("^[a-zA-Z]?:?[\\/]")) | 95 | assert(arg:match("^[a-zA-Z]?:?[\\/]")) |
96 | fs.execute_quiet("if exist "..fs.Q(arg.."\\").." ( RMDIR /S /Q "..fs.Q(arg).." ) else ( DEL /Q /F "..fs.Q(arg).." )") | 96 | fs.execute_quiet("if exist "..fs.Q(arg.."\\*").." ( RMDIR /S /Q "..fs.Q(arg).." ) else ( DEL /Q /F "..fs.Q(arg).." )") |
97 | end | 97 | end |
98 | 98 | ||
99 | --- Recursively scan the contents of a directory. | 99 | --- Recursively scan the contents of a directory. |