diff options
author | Sebastian Thomschke <sebthom@users.noreply.github.com> | 2017-10-04 16:05:00 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-12 21:03:50 -0300 |
commit | 8ad159609280c1ef50e741ac44ccf5300f09b6bc (patch) | |
tree | bf70d87177288a7515c72aa4087bdbe3fc6e6088 | |
parent | 3f60bec6a04eabfe1e86547f49708ea33b319849 (diff) | |
download | luarocks-8ad159609280c1ef50e741ac44ccf5300f09b6bc.tar.gz luarocks-8ad159609280c1ef50e741ac44ccf5300f09b6bc.tar.bz2 luarocks-8ad159609280c1ef50e741ac44ccf5300f09b6bc.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 4adc78d1..6016bc1f 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. |