1 |
|
2 |
|
3 | "use strict";
|
4 |
|
5 |
|
6 |
|
7 | const
|
8 | path = require("path"),
|
9 | fs = require("fs"),
|
10 | gpfSourcesPath = path.join(__dirname, "../../../gpf-js/src"),
|
11 | backupOfGpfSourcePath = global.gpfSourcesPath,
|
12 | backupOfGpf = global.gpf,
|
13 |
|
14 | restoreGlobal = (name, value) => {
|
15 | if (undefined === value) {
|
16 | delete global[name];
|
17 | } else {
|
18 | global[name] = value;
|
19 | }
|
20 | };
|
21 |
|
22 | let
|
23 | stats;
|
24 |
|
25 | try {
|
26 | stats = fs.statSync(gpfSourcesPath);
|
27 | } catch (e) {}
|
28 |
|
29 | if (stats && stats.isDirectory()) {
|
30 | global.gpfSourcesPath = gpfSourcesPath;
|
31 | console.log(gpfSourcesPath);
|
32 | require(gpfSourcesPath + "/boot.js");
|
33 | restoreGlobal("gpfSourcesPath", backupOfGpfSourcePath);
|
34 | module.exports = gpf;
|
35 | restoreGlobal("gpf", backupOfGpf);
|
36 | } else {
|
37 | module.exports = require("./build/gpf.js");
|
38 | }
|