Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/paths.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Bottou <leon@bottou.org>2013-08-27 00:02:38 +0400
committerLeon Bottou <leon@bottou.org>2013-08-27 00:02:38 +0400
commitfdbba0b8c08d55b79ebf9d954424fb14d675db56 (patch)
tree72578d53fad1033c39195e7643a516e8d22a7b59
parentcc5ef04cc68e23b788344911f6dc01b9412b08fc (diff)
clean quotes in results from paths.findprogram
-rw-r--r--init.lua.in12
1 files changed, 7 insertions, 5 deletions
diff --git a/init.lua.in b/init.lua.in
index b290d63..d841027 100644
--- a/init.lua.in
+++ b/init.lua.in
@@ -127,16 +127,18 @@ function findprogram(exe)
for dir in path:gmatch('[^;]+') do
x = concat(dir, exe)
if filep(x) then return x end
- end
+ end
+ local function clean(s)
+ if s:match('^"') then return s:match('[^"]+') else return s end
+ end
k = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\' .. exe
x = getregistryvalue('HKEY_CURRENT_USER', k, '')
- if type(x) == 'string' then return x end
+ if type(x) == 'string' then return clean(x) end
x = getregistryvalue('HKEY_LOCAL_MACHINE', k, '')
- if type(x) == 'string' then return x end
+ if type(x) == 'string' then return clean(x) end
k = 'Applications\\' .. exe .. '\\shell\\open\\command'
x = getregistryvalue('HKEY_CLASSES_ROOT', k, '')
- if type(x) == 'string' and x:match('^"') then x = x:match('[^"]+') end
- if type(x) == 'string' then return x end
+ if type(x) == 'string' then return clean(x) end
else
local path = os.getenv("PATH") or "."
for dir in path:gmatch('[^:]+') do