aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-04-06 16:12:48 -0300
committerHisham Muhammad <hisham@gobolinux.org>2013-04-06 16:12:48 -0300
commit20639f221c605cc1788262af7e8a489adad2ef64 (patch)
treee8d93bc97558c02a1a1e803771d112d6c633d98a /src
parent9b974c94f065ca7867c69c768e6394bbef80ab53 (diff)
downloadluarocks-20639f221c605cc1788262af7e8a489adad2ef64.tar.gz
luarocks-20639f221c605cc1788262af7e8a489adad2ef64.tar.bz2
luarocks-20639f221c605cc1788262af7e8a489adad2ef64.zip
Fix crash in the 'show' command when using a table as entry in rocks_trees config file.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/path.lua10
-rw-r--r--src/luarocks/show.lua4
2 files changed, 11 insertions, 3 deletions
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua
index 64a203ef..2ce0e078 100644
--- a/src/luarocks/path.lua
+++ b/src/luarocks/path.lua
@@ -37,11 +37,19 @@ end
37 37
38function root_dir(rocks_dir) 38function root_dir(rocks_dir)
39 assert(type(rocks_dir) == "string") 39 assert(type(rocks_dir) == "string")
40
41 local suffix = dir.path("lib", "luarocks") 40 local suffix = dir.path("lib", "luarocks")
42 return rocks_dir:match("(.*)" .. suffix .. ".*$") 41 return rocks_dir:match("(.*)" .. suffix .. ".*$")
43end 42end
44 43
44function rocks_tree_to_string(tree)
45 if type(tree) == "string" then
46 return tree
47 else
48 assert(type(tree) == "table")
49 return tree.root
50 end
51end
52
45function deploy_bin_dir(tree) 53function deploy_bin_dir(tree)
46 if type(tree) == "string" then 54 if type(tree) == "string" then
47 return dir.path(tree, "bin") 55 return dir.path(tree, "bin")
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua
index 7849934d..a6a53d9a 100644
--- a/src/luarocks/show.lua
+++ b/src/luarocks/show.lua
@@ -115,7 +115,7 @@ function run(...)
115 if not manifest then return nil,err end 115 if not manifest then return nil,err end
116 local minfo = manifest.repository[name][version][1] 116 local minfo = manifest.repository[name][version][1]
117 117
118 if flags["rock-tree"] then util.printout(repo) 118 if flags["rock-tree"] then util.printout(path.rocks_tree_to_string(repo))
119 elseif flags["rock-dir"] then util.printout(directory) 119 elseif flags["rock-dir"] then util.printout(directory)
120 elseif flags["home"] then util.printout(descript.homepage) 120 elseif flags["home"] then util.printout(descript.homepage)
121 elseif flags["modules"] then util.printout(keys_as_string(minfo.modules)) 121 elseif flags["modules"] then util.printout(keys_as_string(minfo.modules))
@@ -136,7 +136,7 @@ function run(...)
136 if descript.homepage then 136 if descript.homepage then
137 util.printout("Homepage: ", descript.homepage) 137 util.printout("Homepage: ", descript.homepage)
138 end 138 end
139 util.printout("Installed in: ", repo) 139 util.printout("Installed in: ", path.rocks_tree_to_string(repo))
140 if next(minfo.modules) then 140 if next(minfo.modules) then
141 util.printout() 141 util.printout()
142 util.printout("Modules:") 142 util.printout("Modules:")