<commit_before>require("../process/setupenv");
var fs = require("fs");
var path = require("path");
var appname = process.env.APP;
if (!appname) throw `请先设置app名称！如：${/win\d/i.test(process.platform) ? 'set' : 'export'} app=abc`;
var { COMS_PATH, PAGE_PATH, PUBLIC_PATH } = process.env;
function mkdirIfNotExists(dirname) {
    if (!fs.existsSync(dirname))
        fs.mkdirSync(dirname);
}
function throwMakeIfExists(dirname) {
    if (fs.existsSync(dirname))
        throw new Error(`${dirname} 已存在！`);
    else fs.mkdirSync(dirname);
}
mkdirIfNotExists("_envs");
mkdirIfNotExists(PAGE_PATH);
mkdirIfNotExists(COMS_PATH);
mkdirIfNotExists(PUBLIC_PATH);
var setupData = fs.readFileSync(path.join(__dirname, "../_envs/setup.bat"));
setupData = Buffer.concat([new Buffer(`set APP=${appname}\r\n`), setupData]);
fs.writeFileSync(path.join("_envs", "setup.bat"), setupData);
try {
    fs.linkSync(path.join(__dirname, "../coms/zimoli"), path.join(COMS_PATH, "zimoli"));
} catch (e) {
    copy(path.join(__dirname, "../apps/zimoli"), path.join(COMS_PATH, `zimoli`));
}
copy(path.join(__dirname, "../apps/zimoli"), path.join(PAGE_PATH, `${appname}`));

function copy(path1, path2) {
    fs.exists(path2, function (exists) {
        if (exists) console.error(`目标路径已存在：${path2}`);
        else fs.exists(path.dirname(path2), function (exists) {<commit_msg>创建项目时的路径问题修复<commit_after>var fs = require("fs");
var path = require("path");
var appname = process.env.APP;
if (!appname) throw `请先设置app名称！如：${/win\d/i.test(process.platform) ? 'set' : 'export'} app=abc`;
var { COMS_PATH = "./coms", PAGE_PATH = "./apps", PUBLIC_PATH = "./public" } = process.env;
function mkdirIfNotExists(dirname) {
    if (!fs.existsSync(dirname))
        fs.mkdirSync(dirname);
}
function throwMakeIfExists(dirname) {
    if (fs.existsSync(dirname))
        throw new Error(`${dirname} 已存在！`);
    else fs.mkdirSync(dirname);
}
mkdirIfNotExists("_envs");
mkdirIfNotExists(PAGE_PATH);
mkdirIfNotExists(COMS_PATH);
mkdirIfNotExists(PUBLIC_PATH);
mkdirIfNotExists(path.join(PAGE_PATH, `${appname}`));
var setupData = [
    `set app=${appname}`,
    `set PAGE_PATH=${PAGE_PATH}`,
    `set COMS_PATH=${COMS_PATH}`,
    `set public_path=${PUBLIC_PATH}`
].join("\r\n");
setupData = Buffer.from(setupData);
fs.writeFileSync(path.join("_envs", "setup.bat"), setupData);
copy(path.join(__dirname, "../coms/zimoli"), path.join(COMS_PATH, `zimoli`));
var hasindex = false;
fs.readdirSync(path.join(__dirname, "../apps/zimoli")).map(function (name) {
    hasindex = hasindex || /^index.html$/i.test(name);
    copy(path.join(__dirname, "../apps/zimoli/", name), path.join(PAGE_PATH, `${appname}`, name));
});
if (!hasindex) copy(path.join(__dirname, "../apps/index.html"), path.join(PAGE_PATH, `${appname}/index.html`));

function copy(path1, path2) {
    fs.exists(path2, function (exists) {
        if (exists) console.error(`目标路径已存在：${path2}`);
        else fs.exists(path.dirname(path2), function (exists) {
{'fraction_non_alphanumeric': 0.19736842105263158, 'fraction_numerical': 0.0033738191632928477, 'mean_word_length': 5.295116772823779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '59102', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1096, 'n_words': 180}