def ro_root_reference(cmdname, ro_config, rodir, roref=None): """ Find research object root directory. If the supplied rodir is not a local file reference, it is returned as-is, otherwise ro_root_directory is used to locate the RO root directory containing the indicated file. cmdname name of ro command, used in diagnostic messages ro_config RO configuration details, used when resolving supplied directory rodir RO directory supplied via -d option. Must be in configured work area. roref RO reference, supplied by other means, or None. May be any URI reference, resolved against base of file URI for current directory. Returns directory path string, or None if not found, in which case an error message is displayed. """ if not roref: # Process supplied directory option roref = ro_uriutils.resolveFileAsUri(rodir) if ro_uriutils.isFileUri(roref): roref = ro_root_directory(cmdname, ro_config, rodir, restricted=False) else: if rodir: print ("%s: specify either RO directory or URI, not both" % (cmdname)) return 1 roref = ro_uriutils.resolveFileAsUri(roref) return roref
def _isLocal(self): return isFileUri(self.rouri)
def isLocalFileRo(self): """ Test current RO URI to see if it is a local file system reference """ return isFileUri(self.getRoUri())