Mercurial > skaapsteker
changeset 205:466147799786
Add support for Windows in data loading.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Wed, 06 Apr 2011 23:03:34 +0200 |
parents | 0f9715a2f07b |
children | e2acf4663065 |
files | skaapsteker/data.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/skaapsteker/data.py Wed Apr 06 22:49:25 2011 +0200 +++ b/skaapsteker/data.py Wed Apr 06 23:03:34 2011 +0200 @@ -21,6 +21,7 @@ def filepath(filename): '''Determine the path to a file in the data directory. ''' + filename = os.path.join(*filename.split('/')) return os.path.join(data_dir, filename) @@ -29,12 +30,12 @@ "mode" is passed as the second arg to open(). ''' - return open(os.path.join(data_dir, filename), mode) + return open(filepath(filename), mode) -def get_files(filepath): +def get_files(folder): """Return a sorted list of files in the given directory, with the directory stripped""" - return sorted(os.listdir(os.path.join(data_dir, filepath))) + return sorted(os.listdir(filepath(folder))) IMAGES = {}