Skip to content

Commit

Permalink
fix: sample app download images broken (#1094)
Browse files Browse the repository at this point in the history
* fix: sample app download images broken

* fix: cLI download samples

Co-authored-by: Zhiyu You <zhiyou@microsoft.com>
  • Loading branch information
2 people authored and LongOddCode committed May 26, 2021
1 parent ee2169d commit 150011e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/cli/src/cmds/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,10 @@ class NewTemplete extends YargsCommand {
.getEntries()
.filter((entry) => !entry.isDirectory && entry.entryName.includes(appFolder))
.map(async (entry) => {
const data = entry.getData().toString();
const entryPath = entry.entryName.substring(entry.entryName.indexOf("/") + 1);
const filePath = path.join(dstPath, entryPath);
await fs.ensureDir(path.dirname(filePath));
await fs.writeFile(filePath, data);
await fs.writeFile(filePath, entry.getData());
})
);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/fx-core/src/common/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,10 @@ export async function saveFilesRecursively(
.getEntries()
.filter((entry) => !entry.isDirectory && entry.entryName.includes(appFolder))
.map(async (entry) => {
const data = entry.getData().toString();
const entryPath = entry.entryName.substring(entry.entryName.indexOf("/") + 1);
const filePath = path.join(dstPath, entryPath);
await fs.ensureDir(path.dirname(filePath));
await fs.writeFile(filePath, data);
await fs.writeFile(filePath, entry.getData());
})
);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/vscode-extension/src/controls/webviewPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,10 @@ export class WebviewPanel {
.getEntries()
.filter((entry) => !entry.isDirectory && entry.entryName.includes(appFolder))
.map(async (entry) => {
const data = entry.getData().toString();
const entryPath = entry.entryName.substring(entry.entryName.indexOf("/") + 1);
const filePath = path.join(dstPath, entryPath);
await fs.ensureDir(path.dirname(filePath));
await fs.writeFile(filePath, data);
await fs.writeFile(filePath, entry.getData());
})
);
}
Expand Down

0 comments on commit 150011e

Please sign in to comment.