diff options
Diffstat (limited to 'acf/persistence')
-rw-r--r-- | acf/persistence/backends/augeas.lua | 4 | ||||
-rw-r--r-- | acf/persistence/backends/files.lua | 6 | ||||
-rw-r--r-- | acf/persistence/backends/json.lua | 6 | ||||
-rw-r--r-- | acf/persistence/init.lua | 7 |
4 files changed, 13 insertions, 10 deletions
diff --git a/acf/persistence/backends/augeas.lua b/acf/persistence/backends/augeas.lua index 34d7df8..cf4614f 100644 --- a/acf/persistence/backends/augeas.lua +++ b/acf/persistence/backends/augeas.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2012 Kaarle Ritvanen +Copyright (c) 2012-2013 Kaarle Ritvanen See LICENSE file for license details --]] @@ -13,7 +13,7 @@ backend = require('acf.object').class() function backend:init() self.aug = require('augeas').init() end function backend:get(path) - path = '/'..pth.join(unpack(path)) + path = '/'..pth.mjoin(unpack(path)) local _, count = self.aug:match(path) if count == 0 then return end diff --git a/acf/persistence/backends/files.lua b/acf/persistence/backends/files.lua index 8e59ab9..bc9c111 100644 --- a/acf/persistence/backends/files.lua +++ b/acf/persistence/backends/files.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2012 Kaarle Ritvanen +Copyright (c) 2012-2013 Kaarle Ritvanen See LICENSE file for license details --]] @@ -17,7 +17,7 @@ backend = require('acf.object').class() function backend:init() self.cache = {} end function backend:get(path) - local name = pth.join('/', unpack(path)) + local name = pth.mjoin('/', unpack(path)) if not self.cache[name] then local attrs = lfs.attributes(name) @@ -46,7 +46,7 @@ end function backend:set(mods) for _, mod in pairs(mods) do local path, t, value = unpack(mod) - local name = pth.join('/', unpack(path)) + local name = pth.mjoin('/', unpack(path)) -- TODO save references (t == 'reference') as symlinks diff --git a/acf/persistence/backends/json.lua b/acf/persistence/backends/json.lua index 7300ce9..6500d13 100644 --- a/acf/persistence/backends/json.lua +++ b/acf/persistence/backends/json.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2012 Kaarle Ritvanen +Copyright (c) 2012-2013 Kaarle Ritvanen See LICENSE file for license details --]] @@ -34,7 +34,7 @@ function backend:split_path(path) local res while #fpath > 0 do - local fp = pth.join('/', unpack(fpath)) + local fp = pth.mjoin('/', unpack(fpath)) if self.cache[fp] then return fp, jpath end table.insert(jpath, 1, fpath[#fpath]) table.remove(fpath) @@ -43,7 +43,7 @@ function backend:split_path(path) fpath = '/' while true do - fpath = pth.join(fpath, jpath[1]) + fpath = pth.mjoin(fpath, jpath[1]) table.remove(jpath, 1) local attrs = lfs.attributes(fpath) diff --git a/acf/persistence/init.lua b/acf/persistence/init.lua index 2533560..479620b 100644 --- a/acf/persistence/init.lua +++ b/acf/persistence/init.lua @@ -5,6 +5,7 @@ See LICENSE file for license details module(..., package.seeall) +local loadmods = require('acf.loader').loadmods local object = require('acf.object') local super = object.super local pth = require('acf.path') @@ -15,8 +16,10 @@ DataStore = object.class(require('acf.transaction.backend').TransactionBackend) function DataStore:init() super(self, DataStore):init() - self.backends = util.map(function(m) return m.backend() end, - util.loadmods('persistence/backends')) + self.backends = util.map( + function(m) return m.backend() end, + loadmods('persistence/backends') + ) end function DataStore:split_path(path) |