Comparison

util/datamanager.lua @ 12975:d10957394a3c

util: Prefix module imports with prosody namespace
author Kim Alvefur <zash@zash.se>
date Fri, 17 Mar 2023 16:23:16 +0100
parent 12388:50fcd3879482
child 13134:638f627e707f
comparison
equal deleted inserted replaced
12974:ba409c67353b 12975:d10957394a3c
10 local format = string.format; 10 local format = string.format;
11 local setmetatable = setmetatable; 11 local setmetatable = setmetatable;
12 local ipairs = ipairs; 12 local ipairs = ipairs;
13 local char = string.char; 13 local char = string.char;
14 local pcall = pcall; 14 local pcall = pcall;
15 local log = require "util.logger".init("datamanager"); 15 local log = require "prosody.util.logger".init("datamanager");
16 local io_open = io.open; 16 local io_open = io.open;
17 local os_remove = os.remove; 17 local os_remove = os.remove;
18 local os_rename = os.rename; 18 local os_rename = os.rename;
19 local tonumber = tonumber; 19 local tonumber = tonumber;
20 local next = next; 20 local next = next;
21 local type = type; 21 local type = type;
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"prosody.util.envload".envloadfile;
25 local serialize = require "util.serialization".serialize; 25 local serialize = require "prosody.util.serialization".serialize;
26 local lfs = require "lfs"; 26 local lfs = require "lfs";
27 -- Extract directory separator 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;
33 local atomic_append; 33 local atomic_append;
34 local ENOENT = 2; 34 local ENOENT = 2;
35 pcall(function() 35 pcall(function()
36 local pposix = require "util.pposix"; 36 local pposix = require "prosody.util.pposix";
37 raw_mkdir = pposix.mkdir or raw_mkdir; -- Doesn't trample on umask 37 raw_mkdir = pposix.mkdir or raw_mkdir; -- Doesn't trample on umask
38 atomic_append = pposix.atomic_append; 38 atomic_append = pposix.atomic_append;
39 ENOENT = pposix.ENOENT or ENOENT; 39 ENOENT = pposix.ENOENT or ENOENT;
40 end); 40 end);
41 41