优化本地文件打包功能
This commit is contained in:
7
bin/builders/common.ts
vendored
7
bin/builders/common.ts
vendored
@@ -75,17 +75,16 @@ export async function mergeTauriConfig(
|
||||
// } else {
|
||||
// fs.rm
|
||||
// }
|
||||
let file_path = url.slice(8, url.length);
|
||||
const url_exists = await fs.stat(file_path)
|
||||
const url_exists = await fs.stat(url)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (url_exists) {
|
||||
logger.warn("you input may a local file");
|
||||
tauriConf.pake.windows[0].url_type = "local";
|
||||
const file_name = path.basename(file_path);
|
||||
const file_name = path.basename(url);
|
||||
// const dir_name = path.dirname(url);
|
||||
const url_path = path.join("dist/", file_name);
|
||||
await fs.copyFile(file_path, url_path);
|
||||
await fs.copyFile(url, url_path);
|
||||
tauriConf.pake.windows[0].url = file_name;
|
||||
tauriConf.pake.windows[0].url_type = "local";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user