mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 01:08:28 +02:00
Fix tmpdir on Windows
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -28,3 +28,5 @@ dist-ssr
|
|||||||
*.sqlite-*
|
*.sqlite-*
|
||||||
|
|
||||||
.cargo
|
.cargo
|
||||||
|
|
||||||
|
.tmp
|
||||||
|
|||||||
1
plugin-runtime/.gitignore
vendored
1
plugin-runtime/.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
build
|
build
|
||||||
node_modules
|
node_modules
|
||||||
|
*.blob
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const {execSync} = require('node:child_process');
|
const {execSync} = require('node:child_process');
|
||||||
const {tmpdir} = require('node:os');
|
|
||||||
const {cpSync, mkdirSync, chmodSync, unlinkSync} = require('node:fs');
|
const {cpSync, mkdirSync, chmodSync, unlinkSync} = require('node:fs');
|
||||||
const pluginRuntimeDir = path.join(__dirname, '..');
|
const pluginRuntimeDir = path.join(__dirname, '..');
|
||||||
const destDir = path.join(__dirname, '..', '..', 'src-tauri', 'vendored', 'plugin-runtime');
|
const destDir = path.join(__dirname, '..', '..', 'src-tauri', 'vendored', 'plugin-runtime');
|
||||||
@@ -17,8 +16,8 @@ const DST_BIN_MAP = {
|
|||||||
console.log('Building SEA blob');
|
console.log('Building SEA blob');
|
||||||
execSync('node --experimental-sea-config sea-config.json', {cwd: pluginRuntimeDir});
|
execSync('node --experimental-sea-config sea-config.json', {cwd: pluginRuntimeDir});
|
||||||
|
|
||||||
const tmp = path.join(tmpdir(), new Date().toISOString());
|
const tmp = path.join(__dirname, '.tmp', new Date().toISOString());
|
||||||
mkdirSync(tmp);
|
mkdirSync(tmp, {recursive: true});
|
||||||
|
|
||||||
let tmpNodePath = process.platform === 'win32' ? path.join(tmp, 'node.exe') : path.join(tmp, 'node');
|
let tmpNodePath = process.platform === 'win32' ? path.join(tmp, 'node.exe') : path.join(tmp, 'node');
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const decompress = require('decompress');
|
|||||||
const Downloader = require("nodejs-file-downloader");
|
const Downloader = require("nodejs-file-downloader");
|
||||||
const path = require("node:path");
|
const path = require("node:path");
|
||||||
const fs = require("node:fs");
|
const fs = require("node:fs");
|
||||||
const os = require("node:os");
|
|
||||||
const rimraf = require('rimraf');
|
const rimraf = require('rimraf');
|
||||||
|
|
||||||
// `${process.platform}_${process.arch}`
|
// `${process.platform}_${process.arch}`
|
||||||
@@ -35,7 +34,7 @@ const SRC_BIN_MAP = {
|
|||||||
(async function () {
|
(async function () {
|
||||||
const key = `${process.platform}_${process.env.NODE_ARCH ?? process.arch}`;
|
const key = `${process.platform}_${process.env.NODE_ARCH ?? process.arch}`;
|
||||||
const url = URL_MAP[key];
|
const url = URL_MAP[key];
|
||||||
const tmpDir = path.join(os.tmpdir(), `${Math.random()}`);
|
const tmpDir = path.join(__dirname, '.tmp', `${Math.random()}`);
|
||||||
const dstDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'protoc');
|
const dstDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'protoc');
|
||||||
rimraf.sync(dstDir);
|
rimraf.sync(dstDir);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user