Add UnpackState and DownloadState

This commit is contained in:
garrettmills
2020-03-03 16:10:10 -06:00
parent 10bded1681
commit 2725f9eac2
8 changed files with 140 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
const { Injectable } = require('flitter-di')
const moment = require('moment')
const path = require('path')
class UniversalPath extends Injectable {
static get services() {
@@ -56,6 +57,12 @@ class UniversalPath extends Injectable {
return this.is_file() || this.is_directory()
}
async directory() {
await this.classify()
if ( this.is_directory() ) return this.path
return path.dirname(this.path)
}
async classify() {
const dir_result = await this._host.execute(`${this._directory_classify_command} ${this._path}`)
if ( dir_result.exit_code === 0 ) {