summaryrefslogtreecommitdiffstats
path: root/platform/javascript/engine.js
diff options
context:
space:
mode:
authorLeon Krause <lk@leonkrause.com>2018-05-10 13:43:58 +0200
committerLeon Krause <lk@leonkrause.com>2018-05-10 15:08:19 +0200
commit96f907c023b687206df6233be383d724e2810088 (patch)
tree0ed4590505d8858abff0dfc76eb3c2eb02d495c3 /platform/javascript/engine.js
parent32eb3e1b7d2aa6010f154d8b4850357f5a11662a (diff)
downloadredot-engine-96f907c023b687206df6233be383d724e2810088.tar.gz
Accept non-default main packs in engine.js startGame()
Allows using startGame() with main packs exported as .zip, but also any other custom extension, for example if a web game host does not allow the .pck filename extension.
Diffstat (limited to 'platform/javascript/engine.js')
-rw-r--r--platform/javascript/engine.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index 0c1337cc3b..1d78f28bb6 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -130,13 +130,17 @@
this.startGame = function(mainPack) {
executableName = getBaseName(mainPack);
+ var mainArgs = [];
+ if (!getPathLeaf(mainPack).endsWith('.pck')) {
+ mainArgs = ['--main-pack', getPathLeaf(mainPack)];
+ }
return Promise.all([
// Load from directory,
this.init(getBasePath(mainPack)),
// ...but write to root where the engine expects it.
this.preloadFile(mainPack, getPathLeaf(mainPack))
]).then(
- Function.prototype.apply.bind(synchronousStart, this, [])
+ Function.prototype.apply.bind(synchronousStart, this, mainArgs)
);
};