Software /
code /
prosody
Diff
util/datamanager.lua @ 452:613c5c6bdce4
Added option core.data_path
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 28 Nov 2008 20:17:20 +0500 |
parent | 267:6303b7454ad0 |
child | 456:27cb85d4059e |
line wrap: on
line diff
--- a/util/datamanager.lua Fri Nov 28 01:16:26 2008 +0500 +++ b/util/datamanager.lua Fri Nov 28 20:17:20 2008 +0500 @@ -17,6 +17,8 @@ end end +local data_path = "data"; + module "datamanager" @@ -70,14 +72,18 @@ ------- API ------------- +function set_data_path(path) + data_path = path; +end + function getpath(username, host, datastore, ext) ext = ext or "dat"; if username then - return format("data/%s/%s/%s.%s", encode(host), datastore, encode(username), ext); + return format("%s/%s/%s/%s.%s", data_path, encode(host), datastore, encode(username), ext); elseif host then - return format("data/%s/%s.%s", encode(host), datastore, ext); + return format("%s/%s/%s.%s", data_path, encode(host), datastore, ext); else - return format("data/%s.%s", datastore, ext); + return format("%s/%s.%s", data_path, datastore, ext); end end