Mercurial > code > home > repos > light9
changeset 921:e673bdbe0be9
rdfdb: when a new n3 file shows up, fix its path to be relative again so the uri ends up right
Ignore-this: f226c5edc7f794eaaa0d75515eea19fd
author | drewp@bigasterisk.com |
---|---|
date | Mon, 10 Jun 2013 23:14:21 +0000 |
parents | d01b4214e5af |
children | 4def29403ac7 |
files | bin/rdfdb |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/rdfdb Mon Jun 10 23:04:35 2013 +0000 +++ b/bin/rdfdb Mon Jun 10 23:14:21 2013 +0000 @@ -208,6 +208,15 @@ """ if not os.path.isfile(inFile): return + if not any(inFile.startswith(prefix) for prefix in self.topDirsToWatch): + for prefix in self.topDirsToWatch: + prefixAbs = os.path.abspath(prefix) + if inFile.startswith(prefixAbs): + inFile = prefix + inFile[len(prefixAbs):] + break + else: + raise ValueError("can't correct %s to start with one of %s" % + (inFile, self.topDirsToWatch)) if os.path.splitext(inFile)[1] not in ['.n3']: return