Skip to content

Commit

Permalink
Copy qdl to temporary directory
Browse files Browse the repository at this point in the history
  • Loading branch information
monkbroc committed Dec 18, 2024
1 parent ecd66c7 commit d3cbf56
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/lib/qdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@ const utilities = require('../lib/utilities');
const path = require('path');
const fs = require('fs-extra');
const os = require('os');
const util = require('util');
const temp = require('temp').track();
const mkdirTemp = util.promisify(temp.mkdir);

const TACHYON_STORAGE_TYPE = 'ufs';

async function getExecutable() {
const archType = utilities.getArchType();
const archName = utilities.getOs();
const qdlExec = path.join(__dirname, `../../assets/qdl/${archName}/${archType}/qdl`);
await fs.ensureFile(qdlExec);
await fs.chmod(qdlExec, 0o755);
return qdlExec;
const qdlDir = path.join(__dirname, `../../assets/qdl/${archName}/${archType}`);
if (!await fs.pathExists(qdlDir)) {
throw new Error('Flashing Tachyon is not suppported on your OS');
}

// Copy qdl to a temporary directory, so it can run outside the pkg snapshot
const tmpDir = await mkdirTemp('qdl');
await fs.copy(qdlDir, tmpDir);

return path.join(tmpDir, 'qdl' + (archName === 'windows' ? '.exe' : ''));
}

/**
Expand Down

0 comments on commit d3cbf56

Please sign in to comment.