Comparison

core/moduleapi.lua @ 11146:87d6f5924ae9

core.moduleapi: Use resource path for :load_resource()
author Kim Alvefur <zash@zash.se>
date Wed, 07 Oct 2020 16:10:51 +0200
parent 10885:2f751880767c
child 11148:1dc49accb58e
comparison
equal deleted inserted replaced
11145:be73df6765b9 11146:87d6f5924ae9
498 function api:get_directory() 498 function api:get_directory()
499 return self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil; 499 return self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil;
500 end 500 end
501 501
502 function api:load_resource(path, mode) 502 function api:load_resource(path, mode)
503 path = resolve_relative_path(self:get_directory(), path); 503 path = resolve_relative_path(self.resource_path or self:get_directory(), path);
504 return io.open(path, mode); 504 return io.open(path, mode);
505 end 505 end
506 506
507 function api:open_store(name, store_type) 507 function api:open_store(name, store_type)
508 return require"core.storagemanager".open(self.host, name or self.name, store_type); 508 return require"core.storagemanager".open(self.host, name or self.name, store_type);