File: paths.lua

package info (click to toggle)
instead 3.5.2%2Bdfsg-0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,316 kB
  • sloc: ansic: 28,336; sh: 452; makefile: 236
file content (18 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local std = stead
local instead = std.ref '@instead'
-- luacheck: read globals instead_savepath
-- luacheck: read globals instead_gamepath
-- luacheck: read globals instead_exepath
-- luacheck: globals io
instead.savepath = instead_savepath
std.savepath = instead_savepath
instead.gamepath = instead_gamepath
instead.exepath = instead_exepath

io.open = stead.hook(io.open, function(f, path, acc, ...)
	if std.type(path) == 'string' and path:sub(1, 1) ~= '/' and not
		(path:sub(2, 2) == ':' and path:find("^[A-Z]", 1) == 1) then
		path = instead.gamepath()..'/'..path
	end
	return f(path, acc, ...)
end)