Fix everything up so it actually runs lol

This commit is contained in:
2024-04-22 13:53:03 -06:00
parent 33227ec881
commit 32c4c705f6
5 changed files with 35 additions and 40 deletions

View File

@@ -43,8 +43,6 @@ class App {
const self = this,
{ arg, cli } = context
console.log(context)
if(arg.arguments.length > 0) {
let path = $fs.utils.resolvePath(arg.arguments[0])

View File

@@ -1,5 +1,4 @@
const localBasePath = '.config/xash/saves',
localExt = '.jso'
const constants = require('./util/constants.json')
const callIfPresent = (func, args, fallback = false) => {
if(typeof func === 'function') {
@@ -9,6 +8,25 @@ const callIfPresent = (func, args, fallback = false) => {
}
}
// const pathToKey = (path) => {
// let key = $fs.utils.resolvePath(path)
// if(key.startsWith('/a/')) {
// key.slice(3)
// }
// if(key.endsWith('/')) {
// key = key.slice(0, -1)
// }
// return key
// }
const localBasePath = constants.storage.baseKey
const localExt = constants.storage.objectsInFilesystem.ext
console.log('LOCAL BASE PATH', localBasePath)
class EmulatedIDB {
constructor() {
const self = this

View File

@@ -22,8 +22,7 @@ const textDecoder = new TextDecoder('utf-8')
class ModPackage {
static async unpack(buffer, direct = false) {
let asar = new Asar(buffer),
manifestString = textDecoder.decode( asar.get('manifest.json') ),
files = [ ...asar.contents ]
manifestString = textDecoder.decode( asar.get('manifest.json') )
const decompress = path => new Promise((resolve, reject) => {
// gzip(asar.get(path), (error, data) => {
@@ -35,13 +34,17 @@ class ModPackage {
// resolve([ path, toArrayBuffer(data) ])
// })
console.log(path)
resolve([ path, asar.get(path) ])
})
files.splice(files.indexOf('manifest.json'), 1)
files = files.map(decompress)
let files = asar.contents
.toSpliced(asar.contents.indexOf('manifest.json'), 1)
.map(decompress)
files = await Promise.all(files)
console.log(asar, files, manifestString)
return direct ? { files, manifestString } : new this(new Map(files), manifestString)
}