diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/core/path.lua | 11 | ||||
-rw-r--r-- | src/luarocks/core/path.tl | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/luarocks/core/path.lua b/src/luarocks/core/path.lua index 2d267e30..2bfe84e0 100644 --- a/src/luarocks/core/path.lua +++ b/src/luarocks/core/path.lua | |||
@@ -13,11 +13,20 @@ local dir_sep = package.config:sub(1, 1) | |||
13 | function path.rocks_dir(tree) | 13 | function path.rocks_dir(tree) |
14 | if tree == nil then | 14 | if tree == nil then |
15 | tree = cfg.root_dir | 15 | tree = cfg.root_dir |
16 | if tree == nil then | ||
17 | error("root_dir could not be determined in configuration") | ||
18 | end | ||
16 | end | 19 | end |
17 | if type(tree) == "string" then | 20 | if type(tree) == "string" then |
18 | return dir.path(tree, cfg.rocks_subdir) | 21 | return dir.path(tree, cfg.rocks_subdir) |
19 | end | 22 | end |
20 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) | 23 | if tree.rocks_dir then |
24 | return tree.rocks_dir | ||
25 | end | ||
26 | if tree.root and cfg.rocks_subdir then | ||
27 | return dir.path(tree.root, cfg.rocks_subdir) | ||
28 | end | ||
29 | error("invalid configuration for local repository") | ||
21 | end | 30 | end |
22 | 31 | ||
23 | 32 | ||
diff --git a/src/luarocks/core/path.tl b/src/luarocks/core/path.tl index 680c3296..cb5d14dc 100644 --- a/src/luarocks/core/path.tl +++ b/src/luarocks/core/path.tl | |||
@@ -13,11 +13,20 @@ local dir_sep = package.config:sub(1, 1) | |||
13 | function path.rocks_dir(tree: string | Tree): string | 13 | function path.rocks_dir(tree: string | Tree): string |
14 | if tree == nil then | 14 | if tree == nil then |
15 | tree = cfg.root_dir | 15 | tree = cfg.root_dir |
16 | if tree == nil then | ||
17 | error("root_dir could not be determined in configuration") | ||
18 | end | ||
16 | end | 19 | end |
17 | if tree is string then | 20 | if tree is string then |
18 | return dir.path(tree, cfg.rocks_subdir) | 21 | return dir.path(tree, cfg.rocks_subdir) |
19 | end | 22 | end |
20 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) | 23 | if tree.rocks_dir then |
24 | return tree.rocks_dir | ||
25 | end | ||
26 | if tree.root and cfg.rocks_subdir then | ||
27 | return dir.path(tree.root, cfg.rocks_subdir) | ||
28 | end | ||
29 | error("invalid configuration for local repository") | ||
21 | end | 30 | end |
22 | 31 | ||
23 | --- Produce a versioned version of a filename. | 32 | --- Produce a versioned version of a filename. |