This commit is contained in:
C
2022-11-30 18:50:26 +05:00
parent b28a494348
commit 006cfe8b3a
3 changed files with 71 additions and 0 deletions
+11
View File
@@ -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"
]
}]
}
+34
View File
@@ -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
}
+26
View File
@@ -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)
})