forked from mozilla-b2g/gaia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
33 lines (24 loc) · 853 Bytes
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
var utils = require('./utils');
var python = new utils.Commander('python');
exports.execute = function(opts) {
var GAIA_DISTRIBUTION_DIR = utils.getEnv('GAIA_DISTRIBUTION_DIR');
if (GAIA_DISTRIBUTION_DIR === '') {
return;
}
var GAIA_DIR = utils.getEnv('GAIA_DIR');
var remoteList;
try {
remoteList = utils.getFile(GAIA_DISTRIBUTION_DIR, 'remote.list');
} catch(e) {}
if (!remoteList || !remoteList.exists()) {
return;
}
var appFolder = utils.getFile(GAIA_DISTRIBUTION_DIR, 'outoftree_apps/');
utils.deleteFile(appFolder.path, true);
utils.ensureFolderExists(appFolder);
utils.copyFileTo(remoteList, appFolder.path, 'list');
var preload = utils.getFile(GAIA_DIR, 'tools/preload.py').path;
python.initPath(utils.getEnvPath());
return python.run([preload, '--root=' + appFolder.path]);
};