Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 571f4e3

Browse files
committed
fix update, fix AppImageLauncher
1 parent add3d4b commit 571f4e3

3 files changed

Lines changed: 43 additions & 18 deletions

File tree

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
"AppImage"
2727
],
2828
"icon": "build/icons/512.png",
29-
"category": "Game"
29+
"category": "Game",
30+
"desktop": {
31+
"X-AppImage-Integrate": "false"
32+
}
3033
}
3134
},
3235
"repository": "",

src/src/modules/update.js

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import FileSystem from "./file-system";
55
import Network from "./network";
66

77
const child_process = require('child_process');
8+
const fs = require('fs');
89

910
export default class Update {
1011

@@ -139,6 +140,7 @@ export default class Update {
139140
let startFile = this.prefix.getBinDir() + '/start';
140141
let updateFile = this.prefix.getCacheDir() + '/start';
141142
let updateScriptFile = this.prefix.getCacheDir() + '/update.sh';
143+
let log = this.prefix.getCacheDir() + '/update.log';
142144

143145
if (!this.fs.exists(startFile)) {
144146
startFile = this.prefix.getRootDir() + '/start';
@@ -152,13 +154,23 @@ export default class Update {
152154
this.fs.rm(updateFile);
153155
}
154156

157+
if (this.fs.exists(updateScriptFile)) {
158+
this.fs.rm(updateScriptFile);
159+
}
160+
161+
if (this.fs.exists(log)) {
162+
this.fs.rm(log);
163+
}
164+
155165
const updateScript = `#!/usr/bin/env sh
156166
157167
processPid=${window.process.pid}
158168
startFile="${startFile}"
159169
updateFile="${updateFile}"
160170
iterator=0
161171
172+
echo "Start to update"
173+
162174
while [ "$(ps -p $processPid -o comm=)" != "" ]; do
163175
sleep 1
164176
iterator=$((iterator + 1))
@@ -189,18 +201,33 @@ rm -rf "${updateScriptFile}"`;
189201
this.fs.filePutContents(updateScriptFile, updateScript);
190202
this.fs.chmod(updateScriptFile);
191203

192-
try {
193-
const child = child_process.spawn(updateScriptFile, [], {
194-
detached: true,
195-
stdio: ['ignore']
196-
});
197-
198-
child.unref();
199-
} catch (e) {
200-
}
201-
202-
return Utils.sleep(1000).then(() => window.app.getSystem().closeApp());
203-
});
204+
return new Promise((resolve) => {
205+
try {
206+
let isNext = false;
207+
const next = () => {
208+
if (!isNext) {
209+
isNext = true;
210+
resolve();
211+
}
212+
};
213+
214+
let out = fs.openSync(log, 'a');
215+
let err = fs.openSync(log, 'a');
216+
217+
let child = child_process.spawn(updateScriptFile, [], {
218+
detached: true,
219+
stdio: ['ignore', out, err]
220+
});
221+
222+
child.unref();
223+
child.stdout.on('data', (log) => next(log));
224+
child.stderr.on('data', (log) => next(log));
225+
} catch (e) {
226+
resolve();
227+
}
228+
});
229+
})
230+
.then(() => window.app.getSystem().closeApp());
204231
});
205232
}
206233
}

src/src/views/Home.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
mounted() {
4646
this.$store.dispatch(action.get('games').LOAD);
4747
this.$store.dispatch(action.get('prefix').LOAD);
48-
49-
if (window.app.getSystem().isAppImageLauncher() && !window.AppImageLauncher) {
50-
window.AppImageLauncher = true;
51-
this.$refs.AppImageLauncher.open();
52-
}
5348
},
5449
methods: {},
5550
}

0 commit comments

Comments
 (0)