Better tmp dir creation

This commit is contained in:
Gregory Schier
2024-07-19 16:51:05 -07:00
parent 1d6ea42448
commit c480c8d6cf
2 changed files with 4 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ const Downloader = require("nodejs-file-downloader");
const path = require("node:path");
const fs = require("node:fs");
const rimraf = require('rimraf');
const {mkdtempSync} = require("fs");
// `${process.platform}_${process.arch}`
const MAC_ARM = 'darwin_arm64';
@@ -34,7 +35,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(__dirname, '.tmp', `${Math.random()}`);
const tmpDir = mkdtempSync('yaak_protoc');
const dstDir = path.join(__dirname, `..`, 'src-tauri', 'vendored', 'protoc');
rimraf.sync(dstDir);