-
Notifications
You must be signed in to change notification settings - Fork 294
How to get properly capitalized file path on Windows? #15
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
Comments
I don't have a Windows machine handy to test on, so take with a grain of salt, but I believe |
Find a solution based on the |
Thanks! |
My pleasure; it is surprisingly hard to do this, but it it seems that it is not a feature oversight in Node.js, but lacks system API support in the underlying platforms (both on Windows and OS X). Btw, you're (also) using the term "canonical" to refer to what you want, which normally means resolving to an absolute path with all symlinks resolved. |
I have a path, let's say
C:\temp\something.js
and I want to get canonical version of the path on Windows - so if there isC:\Temp\somethinG.js
(note the capital letterT
andG
) stored on disk, I would like to get this value (path). I know that Windows has case-insensitive file system but the file system still knows how user capitalized directory/file names.How can I get from the former path the later one in Node.js?
I have already gone through FS API (https://nodejs.org/api/fs.html) and I have not found anything useful (namely
fs.realpathSync
,fs.statSync
,fs.accessSync
,path.normalize
,path.resolve
did not return what I need).Workaround: I have found out that
fs.readdir
returns correctly capitalized directory/file names but performance hit is too large for any serious usage.Note: http://stackoverflow.com/questions/4763117/how-can-i-obtain-the-case-sensitive-path-on-windows (similar question to mine)
Thanks!
(Migrated from: nodejs/node#3352)
The text was updated successfully, but these errors were encountered: