1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# -*- lua -*-
require 'libpaths'
local assert = assert
local debug = debug
local pcall = pcall
local type = type
local g = _G
module('paths')
install_prefix = [[@Torch_INSTALL_PREFIX@]]
install_bin_subdir = [[@Torch_INSTALL_BIN_SUBDIR@]]
install_man_subdir = [[@Torch_INSTALL_MAN_SUBDIR@]]
install_lib_subdir = [[@Torch_INSTALL_LIB_SUBDIR@]]
install_share_subdir = [[@Torch_INSTALL_SHARE_SUBDIR@]]
install_include_subdir = [[@Torch_INSTALL_INCLUDE_SUBDIR@]]
install_hlp_subdir = [[@Torch_INSTALL_HLP_SUBDIR@]]
install_html_subdir = [[@Torch_INSTALL_HTML_SUBDIR@]]
install_cmake_subdir = [[@Torch_INSTALL_CMAKE_SUBDIR@]]
install_lua_path_subdir = [[@Torch_INSTALL_LUA_PATH_SUBDIR@]]
install_lua_cpath_subdir = [[@Torch_INSTALL_LUA_CPATH_SUBDIR@]]
install_bin_ridbus = [[@Torch_INSTALL_BIN_RIDBUS@]]
install_cmake_ridbus = [[@Torch_INSTALL_CMAKE_RIDBUS@]]
local e = execdir()
if e ~= nil then
install_prefix = concat(e,install_bin_ridbus)
end
install_bin = concat(install_prefix, install_bin_subdir)
install_man = concat(install_prefix, install_man_subdir)
install_lib = concat(install_prefix, install_lib_subdir)
install_share = concat(install_prefix, install_share_subdir)
install_include = concat(install_prefix, install_include_subdir)
install_hlp = concat(install_prefix, install_hlp_subdir)
install_html = concat(install_prefix, install_html_subdir)
install_cmake = concat(install_prefix, install_cmake_subdir)
install_lua_path = concat(install_prefix, install_lua_path_subdir)
install_lua_cpath = concat(install_prefix, install_lua_cpath_subdir)
assert(concat(install_bin,install_bin_ridbus) == install_prefix)
assert(concat(install_cmake,install_cmake_ridbus) == install_prefix)
function files(s)
local d = dir(s)
local n = 0
return function()
n = n + 1
if (d and n <= #d) then
return d[n]
else
return nil
end
end
end
function thisfile(arg, depth)
local s = debug.getinfo(depth or 2).source
if type(s) ~= "string" then
s = nil
elseif s:match("^@") then -- when called from a file
s = concat(s:sub(2))
elseif s:match("^qt[.]") then -- when called from a qtide editor
local function z(s) return g.qt[s].fileName:tostring() end
local b, f = pcall(z, s:sub(4));
if b and f and f ~= "" then s = f else s = nil end
end
if type(arg) == "string" then
if s then s = concat(dirname(s), arg) else s = arg end
end
return s
end
function dofile(f, depth)
local s = thisfile(nil, 1 + (depth or 2))
if s and s ~= "" then
f = concat(dirname(s),f)
end
return g.dofile(f)
end
|