Comparison

util/paths.lua @ 10200:48ee50ed9972

util.paths: Refactored a variable, to avoid shadowing
author João Duarte <jvsDuarte08@gmail.com>
date Thu, 01 Aug 2019 09:29:18 -0700
parent 10197:91085371cfc5
child 10204:fbd4a5bc3a01
comparison
equal deleted inserted replaced
10199:72afd4ed8ac9 10200:48ee50ed9972
43 43
44 function path_util.complement_lua_path(installer_plugin_path) 44 function path_util.complement_lua_path(installer_plugin_path)
45 -- Checking for duplicates 45 -- Checking for duplicates
46 -- The commands using luarocks need the path to the directory that has the /share and /lib folders. 46 -- The commands using luarocks need the path to the directory that has the /share and /lib folders.
47 local lua_version = _VERSION:match(" (.+)$"); 47 local lua_version = _VERSION:match(" (.+)$");
48 local path_sep = package.config:sub(3,3); 48 local lua_path_sep = package.config:sub(3,3);
49 local dir_sep = package.config:sub(1,1); 49 local dir_sep = package.config:sub(1,1);
50 local sub_path = dir_sep.."lua"..dir_sep..lua_version..dir_sep; 50 local sub_path = dir_sep.."lua"..dir_sep..lua_version..dir_sep;
51 if not string.match(package.path, installer_plugin_path) then 51 if not string.match(package.path, installer_plugin_path) then
52 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?.lua"; 52 package.path = package.path..lua_path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?.lua";
53 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?"..dir_sep.."init.lua"; 53 package.path = package.path..lua_path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?"..dir_sep.."init.lua";
54 end 54 end
55 if not string.match(package.path, installer_plugin_path) then 55 if not string.match(package.path, installer_plugin_path) then
56 package.cpath = package.cpath..path_sep..installer_plugin_path..dir_sep.."lib"..sub_path.."?.lua"; 56 package.cpath = package.cpath..lua_path_sep..installer_plugin_path..dir_sep.."lib"..sub_path.."?.lua";
57 end 57 end
58 end 58 end
59 59
60 return path_util; 60 return path_util;