This commit is contained in:
Devine Lu Linvega
2019-07-20 17:33:42 +09:00
parent 3e9cb56089
commit 1e245e144e
4 changed files with 15 additions and 169 deletions

View File

@@ -324,18 +324,22 @@ function Library (ronin) {
this.open = async (path) => { // Imports a graphic file and resizes the frame.
return ronin.surface.open(path)
}
// File System
this.path = (path = ronin.source.path) => { // Returns the content of a folder path.
return path
this.dir = (path = ronin.source.path) => { // Returns the content of a directory.
return fs.existsSync(path) ? fs.readdirSync(path) : []
}
this.folder = (path = this.path()) => { // Returns the path of the current folder.
this.file = (path = ronin.source.path) => { // Returns the content of a file
return fs.existsSync(path) ? fs.readFileSync(p, 'utf8') : ''
}
this.dirpath = (path = ronin.source.path) => { // Returns the path of a directory.
return require('path').dirname(path)
}
this.ls = (path = this.folder()) => { // Returns the content of a folder path.
this.filepath = (path = ronin.source.path) => { // Returns the path of a file
return fs.existsSync(path) ? fs.readdirSync(path) : []
}