Skip to content

Commit

Permalink
Refactor qdl
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Dec 17, 2024
1 parent ae70862 commit e70ea14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/cmd/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ module.exports = class FlashCommand extends CLICommandBase {
zipFile = path.basename(input);
({ baseDir: includeDir, filesToProgram } = await this._extractFlashFilesFromZip(input));
} else {
// TODO: Add restrictions around `/`
filesToProgram = files;
}
// remove the first / from the update folder and all the files
includeDir = includeDir.replace(/^\//, '');
filesToProgram = filesToProgram.map((file) => file.replace(/^\//, ''));

this.ui.write(`Starting download. The download may take several minutes...${os.EOL}`);

Expand Down
9 changes: 1 addition & 8 deletions src/lib/qdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,11 @@ async function getExecutable() {
async function run({ files, updateFolder, zip, verbose, ui }) {
const qdl = await getExecutable();

if (zip) {
// remove the first / from the update folder and all the files
updateFolder = updateFolder.replace(/^\//, '');
files = files.map((file) => file.replace(/^\//, ''));
}

const qdlArgs = [
'--storage',
TACHYON_STORAGE_TYPE,
...(zip ? ['--zip', zip] : []),
'--include',
updateFolder,
...(updateFolder ? ['--include', updateFolder] : []),
...files
];

Expand Down

0 comments on commit e70ea14

Please sign in to comment.