fix import mechanism

This commit is contained in:
joneugster
2023-11-27 17:22:02 +01:00
parent 5fcdee4f71
commit 427ce43e95
8 changed files with 43 additions and 16 deletions
+2 -3
View File
@@ -1,3 +1,2 @@
build
adam
nng
build/
games/
+5 -5
View File
@@ -79,14 +79,14 @@ async function doImport (owner, repo, id) {
artifactId = artifact.id
const url = artifact.archive_download_url
// Make sure the download folder exists
if (!fs.existsSync("../../games")){
fs.mkdirSync("../../games");
if (!fs.existsSync("../games")){
fs.mkdirSync("../games");
}
if (!fs.existsSync("../../games/tmp")){
fs.mkdirSync("../../games/tmp");
if (!fs.existsSync("../games/tmp")){
fs.mkdirSync("../games/tmp");
}
progress[id].output += `Download from ${url}\n`
await download(id, url, `../../games/tmp/${owner.toLowerCase()}_${repo.toLowerCase()}_${artifactId}.zip`)
await download(id, url, `../games/tmp/${owner.toLowerCase()}_${repo.toLowerCase()}_${artifactId}.zip`)
progress[id].output += `Download finished.\n`
await runProcess(id, "/bin/bash", [`${__dirname}/unpack.sh`, artifactId, owner.toLowerCase(), repo.toLowerCase()], ".")
+5 -5
View File
@@ -62,11 +62,11 @@ function startServerProcess(owner, repo) {
}
let game_dir = (owner == 'local') ?
path.join(__dirname, '..', '..', repo) :
path.join(__dirname, '..', '..', 'games', `${owner}`, `${repo}`)
path.join(__dirname, '..', repo) :
path.join(__dirname, '..', 'games', `${owner}`, `${repo}`)
if(!fs.existsSync(path.join(__dirname, '..', '..', 'games'))) {
console.error(`Did not find the following folder: ${path.join(__dirname, '..', '..', 'games')}`)
if(!fs.existsSync(path.join(__dirname, '..', 'games'))) {
console.error(`Did not find the following folder: ${path.join(__dirname, '..', 'games')}`)
console.error('Did you already import any games?')
return
}
@@ -119,7 +119,7 @@ function fillQueue(owner, repo) {
// TODO: We disabled queue for now
if (!isDevelopment) { // Don't use queue in development
for (let tag in games) {
for (let tag in queueLength) {
queue[tag] = []
fillQueue(tag)
}
+1 -1
View File
@@ -5,7 +5,7 @@ OWNER=$2
REPO=$3
echo "Creating folders"
cd ../..
cd ..
# mkdir -p games
cd games
pwd