comparison src/luan/modules/Boot.luan @ 1569:adf83ae2b9ea

undo rel
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 18 Nov 2020 19:41:20 -0700
parents adba594db0b4
children 81288d8b20a2
comparison
equal deleted inserted replaced
1568:adba594db0b4 1569:adf83ae2b9ea
224 local opener = schemes[scheme] or error( "invalid scheme '"..scheme.."' in '"..name.."'" ) 224 local opener = schemes[scheme] or error( "invalid scheme '"..scheme.."' in '"..name.."'" )
225 return opener(location,options) 225 return opener(location,options)
226 end 226 end
227 Boot.uri = uri 227 Boot.uri = uri
228 228
229 --[[
229 local function get_caller_file() 230 local function get_caller_file()
230 for _, ste in ipairs(LuanException.getLuanStackTrace()) do 231 for _, ste in ipairs(LuanException.getLuanStackTrace()) do
231 local f = ste.getFileName() 232 local f = ste.getFileName()
232 if f ~= "luan:Boot.luan" then 233 if f ~= "luan:Boot.luan" then
233 return f 234 return f
236 error() 237 error()
237 end 238 end
238 239
239 function schemes.rel(path) 240 function schemes.rel(path)
240 local f = get_caller_file() 241 local f = get_caller_file()
242 System.out.println(f)
241 f = uri(f) 243 f = uri(f)
242 f.parent or error "source isn't file" 244 f.parent or error "source isn't file"
243 return f.parent().child(path) 245 return f.parent().child(path)
244 end 246 end
245 247 ]]
246 248
247 function Boot.read(uri_str) -- for PackageLuan.java 249 function Boot.read(uri_str) -- for PackageLuan.java
248 local u = uri(uri_str) 250 local u = uri(uri_str)
249 if u==nil or not u.exists() then 251 if u==nil or not u.exists() then
250 return nil 252 return nil