diff options
Diffstat (limited to 'lib/server/tools/storage.py')
-rw-r--r-- | lib/server/tools/storage.py | 22 |
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): |