Comparison

util/datamanager.lua @ 11200:bf8f2da84007

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 05 Nov 2020 22:31:25 +0100
parent 10666:dfc8257d8445
child 11288:5fd1f1b544a0
comparison
equal deleted inserted replaced
11199:6c7c50a4de32 11200:bf8f2da84007
22 local t_insert = table.insert; 22 local t_insert = table.insert;
23 local t_concat = table.concat; 23 local t_concat = table.concat;
24 local envloadfile = require"util.envload".envloadfile; 24 local envloadfile = require"util.envload".envloadfile;
25 local serialize = require "util.serialization".serialize; 25 local serialize = require "util.serialization".serialize;
26 local lfs = require "lfs"; 26 local lfs = require "lfs";
27 -- Extract directory seperator from package.config (an undocumented string that comes with lua) 27 -- Extract directory separator from package.config (an undocumented string that comes with lua)
28 local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) 28 local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" )
29 29
30 local prosody = prosody; 30 local prosody = prosody;
31 31
32 local raw_mkdir = lfs.mkdir; 32 local raw_mkdir = lfs.mkdir;
155 return ret; 155 return ret;
156 end 156 end
157 157
158 local function atomic_store(filename, data) 158 local function atomic_store(filename, data)
159 local scratch = filename.."~"; 159 local scratch = filename.."~";
160 local f, ok, msg, errno; 160 local f, ok, msg, errno; -- luacheck: ignore errno
161 -- TODO return util.error with code=errno?
161 162
162 f, msg, errno = io_open(scratch, "w"); 163 f, msg, errno = io_open(scratch, "w");
163 if not f then 164 if not f then
164 return nil, msg; 165 return nil, msg;
165 end 166 end