PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.69k stars 480 forks source link

File operations won't work on case-sensitive file systems on macOS #1304

Open rjmholt opened 6 years ago

rjmholt commented 6 years ago

The normalizeFilePath function we use in some file manipulation functions assumes that all macOS file systems are case-insensitive, which is not true.

HFS+ and APFS have case-sensitive variants that we should try not to break. Also worth noting that NTFS is also case-sensitive, but Windows is not.

In general, I think we should not try to second guess the operating system and be case-preserving.

rjmholt commented 6 years ago

I've had an idea for this.

Currently we get SaveAs() to just send the path verbatim back to VSCode to handle. But really PowerShell is the expert in filesystems and paths. So it should do all the path handling here because I believe it already has solutions for this problem. Then the extension should just see what it can do with the absolute path it requires and if it doesn't work, do nothing (and log it...).

TylerLeonhardt commented 6 years ago

Ah so you're saying we should handle the SaveAs inside of PSES by using PowerShell?

rjmholt commented 6 years ago

The save can only be done from VSCode because it has access to its window buffer content. But, PowerShell has already solved path handling. So we should resolve the path in PowerShell and then VSCode should just trust it and error if it didn't work.

rjmholt commented 6 years ago

I mean, there are other problems with that probably, but it's one solution. And prevents us from rewriting our own filesystem/path-resolution logic.

TylerLeonhardt commented 6 years ago

I like it!