Improve cmd error classification; add Git repository support
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class FilesystemResourceNotFoundError extends Error {
|
||||
|
||||
}
|
||||
|
||||
module.exports = exports = FilesystemResourceNotFoundError
|
||||
Reference in New Issue
Block a user