You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
maestro/app/classes/state/fs/DirectoryState.js

32 lines
668 B

const State = require('../State')
class DirectoryState extends State {
async apply() {
if ( !(await this.check()) ) {
const path = await this._path()
await path.touch(true)
// TODO directories
}
}
async check() {
const path = await this._path()
await path.classify()
return path.is_directory()
}
async reverse() {
if ( await this.check() ) {
const path = await this._path()
await path.unlink()
}
}
async _path() {
return this._host.get_path(this._config.path)
}
}
module.exports = exports = DirectoryState