Skip to content

Commit

Permalink
review: delete temp file if the user decided to replace 😋
Browse files Browse the repository at this point in the history
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
  • Loading branch information
zFernand0 committed Jan 14, 2025
1 parent 574e794 commit 955da02
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/zowe-explorer/src/dataset/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ export async function createMember(parent: api.IZoweDatasetTreeNode, datasetProv
await ZoweExplorerApiRegister.getMvsApi(profile).createDataSetMember(dsMemberName, {
responseTimeout: profile.profile?.responseTimeout,
});
if (replace === "replace") {
deleteTempFile(dsMemberName, parent);

Check failure on line 424 in packages/zowe-explorer/src/dataset/actions.ts

View workflow job for this annotation

GitHub Actions / lint

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
}
}
} catch (err) {
if (err instanceof Error) {
Expand Down Expand Up @@ -1170,16 +1173,6 @@ export async function deleteDataset(node: api.IZoweTreeNode, datasetProvider: ap
}

datasetProvider.refreshElement(node.getSessionNode());

// remove local copy of file
const fileName = getDocumentFilePath(label, node);
try {
if (fs.existsSync(fileName)) {
fs.unlinkSync(fileName);
}
} catch (err) {
ZoweLogger.warn(err);
}
}

/**
Expand Down Expand Up @@ -1884,3 +1877,14 @@ export async function copyName(node: api.IZoweDatasetTreeNode): Promise<void> {
await vscode.env.clipboard.writeText(node.label as string);
}
}
export async function deleteTempFile(label: string, node: api.IZoweDatasetTreeNode): Promise<void> {

Check failure on line 1880 in packages/zowe-explorer/src/dataset/actions.ts

View workflow job for this annotation

GitHub Actions / lint

Async function 'deleteTempFile' has no 'await' expression
// remove local copy of file
const fileName = getDocumentFilePath(label, node);
try {
if (fs.existsSync(fileName)) {
fs.unlinkSync(fileName);
}
} catch (err) {
ZoweLogger.warn(err);
}
}

0 comments on commit 955da02

Please sign in to comment.