X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-base.lua;h=4182a603c3c169ecd483918ebc689b82fb2ffadb;hb=f078ac2f7998a102c7ec765e725f2269eed9f872;hp=1ed8ab88bee3d96a55a537bdad738d75e3d51231;hpb=ab23049deb6fb90ca689fdf4924b3783f08f8f2e;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-base.lua b/src/ltj-base.lua index 1ed8ab8..4182a60 100644 --- a/src/ltj-base.lua +++ b/src/ltj-base.lua @@ -257,7 +257,7 @@ do if lfs.isdir(testpath) then savepath = testpath; break end end - save_cache_luc = function (filename, t, serialized) + local function save_cache_luc(filename, t, serialized) local fullpath = savepath .. '/' .. filename .. luc_suffix local s = serialized or serialize(t, 'return', false) if s then @@ -271,7 +271,7 @@ do end end - save_cache = function (filename, t) + local function save_cache(filename, t) local fullpath = savepath .. '/' .. filename .. '.lua' local s = serialize(t, 'return', false) if s then @@ -285,7 +285,7 @@ do end end - local function load_cache_a (filename, outdate) + local function load_cache_a(filename, outdate) local result for _,v in pairs(path) do local fn = join(v, cache_dir, filename) @@ -302,7 +302,7 @@ do end end - load_cache = function (filename, outdate) + local function load_cache(filename, outdate) local r = load_cache_a(filename .. luc_suffix, outdate) if r then return r @@ -313,6 +313,17 @@ do end end + local function remove_file_if_exist(name) + if os.rename(name,name) then os.remove(name) end + end + local function remove_cache (filename) + local fullpath_wo_ext = savepath .. '/' .. filename .. '.lu' + remove_file_if_exist(fullpath_wo_ext .. 'a') + remove_file_if_exist(fullpath_wo_ext .. 'b') + remove_file_if_exist(fullpath_wo_ext .. 'c') + end + + ltjb.remove_cache = remove_cache ltjb.load_cache = load_cache ltjb.save_cache_luc = save_cache_luc ltjb.save_cache = save_cache