dirname & filename
This commit is contained in:
parent
7dcebb8865
commit
83f3063bba
@ -133,6 +133,8 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
|
|||||||
- `(file ~path)` Returns the content of a file.
|
- `(file ~path)` Returns the content of a file.
|
||||||
- `(dirpath ~path)` Returns the path of a directory.
|
- `(dirpath ~path)` Returns the path of a directory.
|
||||||
- `(filepath ~path)` Returns the path of a file.
|
- `(filepath ~path)` Returns the path of a file.
|
||||||
|
- `(dirname ~path)` Returns the name of a folder.
|
||||||
|
- `(filename ~path)` Returns the name of a file.
|
||||||
- `(exit ~force)` Exits Ronin.
|
- `(exit ~force)` Exits Ronin.
|
||||||
- `(echo ...args)` Print arguments to interface.
|
- `(echo ...args)` Print arguments to interface.
|
||||||
- `(debug arg)` Print arguments to console.
|
- `(debug arg)` Print arguments to console.
|
||||||
|
@ -517,6 +517,10 @@ function Library (ronin) {
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.dirname = (path = this.filepath()) => { // Returns the name of a folder.
|
||||||
|
return require('path').basename(require('path').dirname(path))
|
||||||
|
}
|
||||||
|
|
||||||
this.filename = (path = this.filepath()) => { // Returns the name of a file.
|
this.filename = (path = this.filepath()) => { // Returns the name of a file.
|
||||||
return require('path').parse(path).name
|
return require('path').parse(path).name
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user