1local std = stead
2local instead = std.ref '@instead'
3-- luacheck: read globals instead_savepath
4-- luacheck: read globals instead_gamepath
5-- luacheck: read globals instead_exepath
6-- luacheck: globals io
7instead.savepath = instead_savepath
8std.savepath = instead_savepath
9instead.gamepath = instead_gamepath
10instead.exepath = instead_exepath
11
12io.open = stead.hook(io.open, function(f, path, acc, ...)
13	if std.type(path) == 'string' and path:sub(1, 1) ~= '/' and not
14		(path:sub(2, 2) == ':' and path:find("^[A-Z]", 1) == 1) then
15		path = instead.gamepath()..'/'..path
16	end
17	return f(path, acc, ...)
18end)
19