codefori / vscode-ibmi

🌍 IBM i development extension for VS Code
https://codefori.github.io/docs/#/
MIT License
264 stars 91 forks source link

Fix `countFiles` when directory does not exist #2142

Closed SanjulaGanepola closed 1 day ago

SanjulaGanepola commented 6 days ago

Changes

The countFiles function ends up counting the number of files in the home directory when the directory that it is given does not exist. Although I have not noticed any issue in Code4i because of this, it causes an issue in Project Explorer (as it calls getDeployCompareFiles) where it shows that it is going to delete the contents of my home directory:

image

Without this fix, the issue can also be observed in the updated test where the countFiles result ends up counting the number of files in my home directory rather than the directory provided:

image

How to test this PR

  1. Use the test case provided
  2. Use Project Explorer:
    • Deploy your workspace
    • Delete the deploy location using the IFS browser
    • Refresh the source in the Project Explorer and observe the contents of the home directory is not visible unlike the first image above

Checklist