diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-11-05 17:38:25 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-11-05 17:38:25 (GMT) |
commit | 1876bb9c16f926d6865481f576de0def6f927f95 (patch) | |
tree | 66479187a9bb4542a924337f9155536a7ffb87c9 /apps/samples/vrml/vrml-server.scxml | |
parent | 55ce66061f7b886cf831f756851ced929f022c99 (diff) | |
download | uscxml-1876bb9c16f926d6865481f576de0def6f927f95.zip uscxml-1876bb9c16f926d6865481f576de0def6f927f95.tar.gz uscxml-1876bb9c16f926d6865481f576de0def6f927f95.tar.bz2 |
Support for "latest" when fetching 3d models
Diffstat (limited to 'apps/samples/vrml/vrml-server.scxml')
-rw-r--r-- | apps/samples/vrml/vrml-server.scxml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/samples/vrml/vrml-server.scxml b/apps/samples/vrml/vrml-server.scxml index 0a66849..b0a1fc5 100644 --- a/apps/samples/vrml/vrml-server.scxml +++ b/apps/samples/vrml/vrml-server.scxml @@ -34,6 +34,22 @@ struct.key = _event.data.pathComponent.slice(1, _event.data.pathComponent.length - 1).join(pathDelim); if (struct.key.length > 0) struct.key += pathDelim; + + // support for meta file "latest.ext" + if (struct.file === "latest") { + dump(struct); + var latestStamp = 0; + for (var key in models) { + if (key.substring(0, struct.key.length) == struct.key) { + if (models[key].ctime > latestStamp) { + var name = models[key].strippedName; + struct.file = name.substring(name.lastIndexOf(pathDelim) + 1); + latestStamp = models[key].ctime; + } + } + } + } + struct.key += struct.file; return struct; |