init
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"applications":[{
|
||||
"path":"D:/shared/Builds/Fortis_UnStable_64/WindowsNoEditor/FORTIS_Taktika.exe",
|
||||
"args":[
|
||||
"-maxfps=41",
|
||||
"-PixelStreamingIP=127.0.0.1",
|
||||
"-PixelStreamingPort=8888",
|
||||
"-ResX 1920 -ResY 1080"
|
||||
]
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const node_time = require('node-datetime')
|
||||
const util = require('util')
|
||||
|
||||
module.exports = class logger {
|
||||
constructor(filepath) {
|
||||
this.#filepath = filepath
|
||||
this.#filename = path.basename(filepath)
|
||||
var dirname = path.dirname(filepath)
|
||||
|
||||
if (!fs.existsSync(dirname))
|
||||
fs.mkdirSync(dirname, {recursive:true})
|
||||
}
|
||||
error(...arg) {
|
||||
this.#log('error', arg)
|
||||
}
|
||||
log(...arg) {
|
||||
this.#log('', arg)
|
||||
}
|
||||
|
||||
#log(message = '', ...arg) {
|
||||
var args = ''
|
||||
arg.forEach(value => {
|
||||
args += util.format(value) + ' '
|
||||
})
|
||||
args = (node_time.create().format('Y-m-d H:M:S')).toString() + ((message != '') ? ': ' + message : '') + ': ' + args
|
||||
console.log(this.#filename + ': ' + args)
|
||||
fs.appendFileSync(this.#filepath, args + '\n')
|
||||
}
|
||||
|
||||
#filepath
|
||||
#filename
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
const config = require('./config.json')
|
||||
const logger = require('./lib/logger')
|
||||
const { spawn } = require('node:child_process')
|
||||
|
||||
const logger_runtime = new logger('./logs/runtime.log')
|
||||
logger_runtime.log('start application')
|
||||
|
||||
function start_proc(path, args) {
|
||||
// start app_proc
|
||||
const app_proc = spawn(path, args, {
|
||||
detached: true
|
||||
})
|
||||
app_proc.on('error', function(err) {
|
||||
logger_runtime.error(err)
|
||||
start_proc(path, args)
|
||||
return
|
||||
})
|
||||
app_proc.on('close', (code) => {
|
||||
logger_runtime.error('code: ', code)
|
||||
start_proc(path, args)
|
||||
return
|
||||
})
|
||||
}
|
||||
config.applications.forEach(app => {
|
||||
start_proc(app.path, app.args)
|
||||
})
|
||||
Reference in New Issue
Block a user