summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-texworks.lua')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-texworks.lua48
1 files changed, 27 insertions, 21 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua b/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua
index 73ab846cd7f..33e56df468a 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-texworks.lua
@@ -6,6 +6,19 @@ if not modules then modules = { } end modules ['mtx-texworks'] = {
license = "see context related readme files"
}
+local helpinfo = [[
+--start [--verbose] start texworks
+--test report what will happen
+]]
+
+local application = logs.application {
+ name = "mtx-texworks",
+ banner = "TeXworks Startup Script 1.00",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
scripts = scripts or { }
scripts.texworks = scripts.texworks or { }
@@ -25,35 +38,35 @@ local texworkininame = "texworks.ini"
function scripts.texworks.start(indeed)
local workname = (os.type == "windows" and "texworks.exe") or "texworks"
local fullname = nil
- local binpaths = file.split_path(os.getenv("PATH")) or file.split_path(os.getenv("path"))
+ local binpaths = file.splitpath(os.getenv("PATH")) or file.splitpath(os.getenv("path"))
local usedsignal = texworkssignal
- local datapath = resolvers.find_file(usedsignal,"other text files") or ""
+ local datapath = resolvers.findfile(usedsignal,"other text files") or ""
if datapath ~= "" then
datapath = file.dirname(datapath) -- data
if datapath == "" then
- datapath = resolvers.clean_path(lfs.currentdir())
+ datapath = resolvers.cleanpath(lfs.currentdir())
end
else
usedsignal = texworkininame
- datapath = resolvers.find_file(usedsignal,"other text files") or ""
+ datapath = resolvers.findfile(usedsignal,"other text files") or ""
if datapath == "" then
usedsignal = string.lower(usedsignal)
- datapath = resolvers.find_file(usedsignal,"other text files") or ""
+ datapath = resolvers.findfile(usedsignal,"other text files") or ""
end
if datapath ~= "" and lfs.isfile(datapath) then
datapath = file.dirname(datapath) -- TUG
datapath = file.dirname(datapath) -- data
if datapath == "" then
- datapath = resolvers.clean_path(lfs.currentdir())
+ datapath = resolvers.cleanpath(lfs.currentdir())
end
end
end
if datapath == "" then
- logs.simple("invalid datapath, maybe you need to regenerate the file database")
+ report("invalid datapath, maybe you need to regenerate the file database")
return false
end
if not binpaths or #binpaths == 0 then
- logs.simple("invalid binpath")
+ report("invalid binpath")
return false
end
for i=1,#binpaths do
@@ -64,7 +77,7 @@ function scripts.texworks.start(indeed)
end
end
if not fullname then
- logs.simple("unable to locate %s",workname)
+ report("unable to locate %s",workname)
return false
end
for i=1,#texworkspaths do
@@ -73,27 +86,20 @@ function scripts.texworks.start(indeed)
os.setenv("TW_INIPATH",datapath)
os.setenv("TW_LIBPATH",datapath)
if not indeed or environment.argument("verbose") then
- logs.simple("used signal: %s", usedsignal)
- logs.simple("data path : %s", datapath)
- logs.simple("full name : %s", fullname)
- logs.simple("set paths : TW_INIPATH TW_LIBPATH")
+ report("used signal: %s", usedsignal)
+ report("data path : %s", datapath)
+ report("full name : %s", fullname)
+ report("set paths : TW_INIPATH TW_LIBPATH")
end
if indeed then
os.launch(fullname)
end
end
-logs.extendbanner("TeXworks Startup Script 1.00",true)
-
-messages.help = [[
---start [--verbose] start texworks
---test report what will happen
-]]
-
if environment.argument("start") then
scripts.texworks.start(true)
elseif environment.argument("test") then
scripts.texworks.start()
else
- logs.help(messages.help)
+ application.help()
end