Skip to content

Commit aa9b10d

Browse files
tree: Fix example file generation (#142)
Adapt example file generation to the updated method signature of FileSystemUtils.generateUniqueResourceURI Fixes #138 Signed-off-by: Lucas Koehler <[email protected]>
1 parent 1520277 commit aa9b10d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/tree-editor/example-file/example-file-command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ export class NewTreeExampleFileCommandHandler implements SingleUriCommandHandler
4545
return;
4646
}
4747

48-
const dirUri = dir.resource;
49-
const preliminaryFileUri = FileSystemUtils.generateUniqueResourceURI(dirUri, dir, 'tree-example', '.tree');
48+
const targetUri = dir.resource.resolve('tree-example.tree');
49+
const preliminaryFileUri = FileSystemUtils.generateUniqueResourceURI(dir, targetUri, false);
5050
const dialog = new SingleTextInputDialog({
5151
title: 'New Example File',
5252
initialValue: preliminaryFileUri.path.base
5353
});
5454

5555
const fileName = await dialog.open();
5656
if (fileName) {
57-
const fileUri = dirUri.resolve(fileName);
57+
const fileUri = dir.resource.resolve(fileName);
5858
const contentBuffer = BinaryBuffer.fromString(JSON.stringify(defaultData, null, 2));
5959
this.fileService.createFile(fileUri, contentBuffer)
6060
.then(_ => this.openerService.getOpener(fileUri))

0 commit comments

Comments
 (0)