Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - baseFolders config does not work with ~ in path #663

Open
nathanstone opened this issue Jan 8, 2023 · 5 comments
Open

[BUG] - baseFolders config does not work with ~ in path #663

nathanstone opened this issue Jan 8, 2023 · 5 comments
Labels

Comments

@nathanstone
Copy link

Environment/version

  • Extension version: v12.7.0
  • VSCode version: 1.74.2
  • OS version: macOS Ventura 13.1, M1 Max chip

Steps to reproduce

  1. Completely remove any baseFolders config from settings.json e.g. projectManager.any.baseFolders
  2. Re-add baseFolders config, either manually to settings.json or from Settings window, making sure to include a path with ~ e.g.
"projectManager.any.baseFolders": [
  "~/Sites"
]
  1. The Any option will now be missing from the Project Manager views.
  2. The developer log gives the following error:
workbench.desktop.main.js:89 [Extension Host] stack trace: Error: ENOENT: no such file or directory, lstat '~/Sites'
    at lstatSync (node:fs:1516:3)
    at Object.e.lstatSync (node:electron/js2c/asar_bundle:5:3752)
    at Function.handleSymlinks (/Users/nathan/.vscode/extensions/alefragnani.project-manager-12.7.0/dist/extension.js:1:113300)
    at t.CustomProjectLocator.locateProjects (/Users/nathan/.vscode/extensions/alefragnani.project-manager-12.7.0/dist/extension.js:1:87907)
    at /Users/nathan/.vscode/extensions/alefragnani.project-manager-12.7.0/dist/extension.js:1:88965
    at new Promise (<anonymous>)
    at t.CustomProjectLocator.refreshProjects (/Users/nathan/.vscode/extensions/alefragnani.project-manager-12.7.0/dist/extension.js:1:88788)
    at /Users/nathan/.vscode/extensions/alefragnani.project-manager-12.7.0/dist/extension.js:1:172821
  1. Expanding the config to the full path, will make it the Any option reappear e.g.
"projectManager.any.baseFolders": [
  "/Users/nathan/Sites"
]

Continuing the conversation from issue #656

@nathanstone nathanstone added the bug label Jan 8, 2023
@alefragnani
Copy link
Owner

Hi @nathanstone ,

Thanks for the details, specially the log.

Out of curiosity, what happens if you use $home instead of the tilde symbol (~). Does it work?

Thank you

@nathanstone
Copy link
Author

Assuming you mean something like this:

"projectManager.any.baseFolders": [
  "$home/Sites"
],

I get the exact same error.

@alefragnani
Copy link
Owner

In this case, I suppose there is some issue with Node.js on your computer. Not sure why.

For some reason, os.homedir(); seems not to be working for you. I use this as a replacement for ~ and $home while processing the paths.

@alefragnani
Copy link
Owner

@nathanstone ,

Are you still not able to use ~ or $home in the baseFolders settings? If not, could you try out this in Node.js REPL?

  1. Open node REPL typing node in the shell
  2. Type os.homedir()
  3. What is the output?
  4. Type os.userInfo().homedir
  5. What is the output?

The expected return in steps 3 and 5 should be /Users/nathan for you.

@nathanstone
Copy link
Author

Still can't use either, only the full path works.

Running the above scripts outputs exactly as you predicted.

Tested on Node v18.12.1 & v16.19.1 on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants