aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fetch.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index 2cad3df2..6f8dfc0b 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -363,19 +363,18 @@ function fetch.get_sources(rockspec, extract, dest_dir)
363 -- we're looking for. 363 -- we're looking for.
364 -- We only do this if the rockspec source.dir was not set, and only 364 -- We only do this if the rockspec source.dir was not set, and only
365 -- with rockspecs newer than 3.0. 365 -- with rockspecs newer than 3.0.
366 local dir_count, found_dir = 0 366 local file_count, found_dir = 0
367 367
368 if not rockspec.source.dir_set and rockspec:format_is_at_least("3.0") then 368 if not rockspec.source.dir_set and rockspec:format_is_at_least("3.0") then
369 local files = fs.list_dir() 369 for file in fs.dir() do
370 for _, f in ipairs(files) do 370 file_count = file_count + 1
371 if fs.is_dir(f) then 371 if fs.is_dir(file) then
372 dir_count = dir_count + 1 372 found_dir = file
373 found_dir = f
374 end 373 end
375 end 374 end
376 end 375 end
377 376
378 if dir_count == 1 then 377 if file_count == 1 and found_dir then
379 rockspec.source.dir = found_dir 378 rockspec.source.dir = found_dir
380 else 379 else
381 return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file, "source.dir", source_file, store_dir 380 return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file, "source.dir", source_file, store_dir