Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib/server/tools/storage.py
diff options
context:
space:
mode:
authorflorent <florent.pigout@gmail.com>2011-09-10 13:36:37 (GMT)
committer florent <florent.pigout@gmail.com>2011-09-10 13:36:37 (GMT)
commit8f31d026978352524cd8d8059d313980b90a4947 (patch)
tree4ea6c27f9b48ccf58290f81329112f4ce403fcf0 /lib/server/tools/storage.py
parentade7c7edac25ce8df70bf1d15a6c8ed093902c79 (diff)
upgrade web POC with last lib version from nutrinoweb experimentsHEADmaster
Diffstat (limited to 'lib/server/tools/storage.py')
-rw-r--r--lib/server/tools/storage.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/server/tools/storage.py b/lib/server/tools/storage.py
index 535eb66..2dc386c 100644
--- a/lib/server/tools/storage.py
+++ b/lib/server/tools/storage.py
@@ -12,21 +12,37 @@ ACTIVITY_NAMES = {
}
+def check_dir(path):
+ if os.path.exists(path):
+ pass
+ else:
+ os.mkdir(path)
+
+
+def check_file(path):
+ if os.path.exists(path):
+ pass
+ else:
+ _f = open(path, 'wb')
+ _f.write('')
+ _f.close()
+
+
def get_path(path=None, bundle=True):
# ..
- path = 'static' if path is None else os.path.join('static', path)
+ path = 'static' if path is None else path
# ..
if bundle is True:
return os.path.join(BUNDLE, path)
else:
- return os.path.join(ROOT, 'data', path)
+ return os.path.join(ROOT, path)
def list_dir(path=None, bundle=True):
# ..
path = get_path(path=path, bundle=bundle)
# ..
- return [os.path.join(path, _f) for _f in os.listdir(path)]
+ return os.listdir(path)
def get_sound_path(filename, path=None, bundle=True, ext=None):