|
@@ -1,5 +1,6 @@
|
|
|
const path = window.nodeRequire("path");
|
|
|
const fs = window.nodeRequire("fs");
|
|
|
+const process = window.nodeRequire('process')
|
|
|
const homePath = path.dirname(process.execPath);
|
|
|
const storePath = path.join(homePath, "stores");
|
|
|
const extraPath =
|
|
@@ -7,7 +8,6 @@ const extraPath =
|
|
|
? path.join(homePath, "extra")
|
|
|
: path.join(__static, "../extra");
|
|
|
|
|
|
-initPath();
|
|
|
function initPath() {
|
|
|
const paths = [
|
|
|
storePath,
|
|
@@ -16,16 +16,22 @@ function initPath() {
|
|
|
getOutputDir("origin"),
|
|
|
getTmpDir(),
|
|
|
];
|
|
|
+ console.log(paths);
|
|
|
paths.forEach(path => {
|
|
|
if (!fs.existsSync(path)) fs.mkdirSync(path);
|
|
|
});
|
|
|
}
|
|
|
+initPath();
|
|
|
+
|
|
|
// base
|
|
|
function getHomeDir(name) {
|
|
|
+ const homePath = path.dirname(process.execPath);
|
|
|
return path.join(homePath, name);
|
|
|
}
|
|
|
|
|
|
function getStoresDir(name) {
|
|
|
+ const homePath = path.dirname(process.execPath);
|
|
|
+ const storePath = path.join(homePath, "stores");
|
|
|
return path.join(storePath, name);
|
|
|
}
|
|
|
|
|
@@ -84,6 +90,7 @@ function initConfigData(data) {
|
|
|
if (!configData.input) configData.input = getInputDir();
|
|
|
|
|
|
if (process.env.NODE_ENV === "development") return configData;
|
|
|
+ const homePath = path.dirname(process.execPath);
|
|
|
|
|
|
const configPath = path.join(homePath, "config.json");
|
|
|
if (fs.existsSync(configPath)) {
|