Improve cmd error classification; add Git repository support

This commit is contained in:
garrettmills
2020-03-05 10:25:45 -06:00
parent ec8047361c
commit 24c18e4277
4 changed files with 102 additions and 3 deletions

View File

@@ -65,10 +65,16 @@ class UniversalPath extends Injectable {
async parent() {
await this.classify()
if ( this.is_directory() ) return path.resolve(this.path, '..')
if ( this.is_directory() ) return path.join(this.path, '..')
return this.directory()
}
async child(subpath) {
await this.classify()
if ( !this.is_directory() ) throw new Error('Cannot get sub-path: not a directory: '+this.path)
return this.constructor.fromString(path.join(String(this), subpath))
}
name() {
return path.basename(this.path)
}

View File

@@ -0,0 +1,5 @@
class FilesystemResourceNotFoundError extends Error {
}
module.exports = exports = FilesystemResourceNotFoundError