Software /
code /
prosody
Diff
util/datamanager.lua @ 454:21105a005eef
Merge from waqas
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 28 Nov 2008 18:06:29 +0000 |
parent | 452:613c5c6bdce4 |
child | 456:27cb85d4059e |
line wrap: on
line diff
--- a/util/datamanager.lua Fri Nov 28 00:08:23 2008 +0000 +++ b/util/datamanager.lua Fri Nov 28 18:06:29 2008 +0000 @@ -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