Fix tmpdir on Windows

This commit is contained in:
Gregory Schier
2024-07-19 16:43:22 -07:00
parent 447932697d
commit a43f601b6a
4 changed files with 6 additions and 5 deletions

2
.gitignore vendored
View File

@@ -28,3 +28,5 @@ dist-ssr
*.sqlite-*
.cargo
.tmp

View File

@@ -1,2 +1,3 @@
build
node_modules
*.blob

View File

@@ -1,6 +1,5 @@
const path = require('node:path');
const {execSync} = require('node:child_process');
const {tmpdir} = require('node:os');
const {cpSync, mkdirSync, chmodSync, unlinkSync} = require('node:fs');
const pluginRuntimeDir = path.join(__dirname, '..');
const destDir = path.join(__dirname, '..', '..', 'src-tauri', 'vendored', 'plugin-runtime');
@@ -17,8 +16,8 @@ const DST_BIN_MAP = {
console.log('Building SEA blob');
execSync('node --experimental-sea-config sea-config.json', {cwd: pluginRuntimeDir});
const tmp = path.join(tmpdir(), new Date().toISOString());
mkdirSync(tmp);
const tmp = path.join(__dirname, '.tmp', new Date().toISOString());
mkdirSync(tmp, {recursive: true});
let tmpNodePath = process.platform === 'win32' ? path.join(tmp, 'node.exe') : path.join(tmp, 'node');

View File

@@ -2,7 +2,6 @@ const decompress = require('decompress');
const Downloader = require("nodejs-file-downloader");
const path = require("node:path");
const fs = require("node:fs");
const os = require("node:os");
const rimraf = require('rimraf');
// `${process.platform}_${process.arch}`
@@ -35,7 +34,7 @@ const SRC_BIN_MAP = {
(async function () {
const key = `${process.platform}_${process.env.NODE_ARCH ?? process.arch}`;
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');
rimraf.sync(dstDir);