|
@@ -13,14 +13,7 @@ function initPath() {
|
|
storePath,
|
|
storePath,
|
|
getInputDir(),
|
|
getInputDir(),
|
|
getStoresDir("out"),
|
|
getStoresDir("out"),
|
|
- getOutputDir("formal"),
|
|
|
|
- getOutputDir("slice"),
|
|
|
|
- getTmpDir(),
|
|
|
|
- // cropper
|
|
|
|
- getStoresDir("cropper"),
|
|
|
|
- path.join(getStoresDir("cropper"), "origin"),
|
|
|
|
- path.join(getStoresDir("cropper"), "formal"),
|
|
|
|
- path.join(getStoresDir("cropper"), "slice")
|
|
|
|
|
|
+ getOutputDir("origin")
|
|
];
|
|
];
|
|
paths.forEach(path => {
|
|
paths.forEach(path => {
|
|
if (!fs.existsSync(path)) fs.mkdirSync(path);
|
|
if (!fs.existsSync(path)) fs.mkdirSync(path);
|
|
@@ -55,23 +48,6 @@ function getDatabaseDir() {
|
|
return getExtraDir("database");
|
|
return getExtraDir("database");
|
|
}
|
|
}
|
|
|
|
|
|
-function getImgDecodeTool() {
|
|
|
|
- return path.join(getExtraDir("zxingA"), "zxing.exe");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function getFontPath() {
|
|
|
|
- // 文件名必须是英文,否则会报错
|
|
|
|
- return path.join(getExtraDir("font"), "simhei-subfont.ttf");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function getEncryptPath() {
|
|
|
|
- return path.join(getExtraDir("encrypt"), "msyjencrypt.exe");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function getHardwareCheckPath() {
|
|
|
|
- return path.join(getExtraDir("artControl"), "ArtControl.exe");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @param {String} pathContent 目录路径
|
|
* @param {String} pathContent 目录路径
|
|
@@ -90,9 +66,9 @@ function makeDirSync(pathContent) {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-function formatNum(num, [min, max]) {
|
|
|
|
- return !num || num > max || num < min ? max : num;
|
|
|
|
-}
|
|
|
|
|
|
+// function formatNum(num, [min, max]) {
|
|
|
|
+// return !num || num > max || num < min ? max : num;
|
|
|
|
+// }
|
|
|
|
|
|
function initConfigData(data) {
|
|
function initConfigData(data) {
|
|
let configData = { ...data };
|
|
let configData = { ...data };
|
|
@@ -103,7 +79,6 @@ function initConfigData(data) {
|
|
const configPath = path.join(homePath, "config.json");
|
|
const configPath = path.join(homePath, "config.json");
|
|
if (fs.existsSync(configPath)) {
|
|
if (fs.existsSync(configPath)) {
|
|
configData = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
configData = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
- configData.compressRate = formatNum(configData.compressRate, [0, 100]);
|
|
|
|
if (!configData.input) configData.input = getInputDir();
|
|
if (!configData.input) configData.input = getInputDir();
|
|
} else {
|
|
} else {
|
|
fs.writeFileSync(configPath, JSON.stringify(configData), "utf8");
|
|
fs.writeFileSync(configPath, JSON.stringify(configData), "utf8");
|
|
@@ -122,9 +97,5 @@ export {
|
|
getTmpDir,
|
|
getTmpDir,
|
|
makeDirSync,
|
|
makeDirSync,
|
|
getDatabaseDir,
|
|
getDatabaseDir,
|
|
- getImgDecodeTool,
|
|
|
|
- getFontPath,
|
|
|
|
- getEncryptPath,
|
|
|
|
- getHardwareCheckPath,
|
|
|
|
initConfigData
|
|
initConfigData
|
|
};
|
|
};
|