diff options
author | Thomas <hakerh403@gmail.com> | 2019-09-16 10:45:05 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-10-03 20:46:53 -0700 |
commit | 6265e4166aa7a7a7697d52f3a528f3372226b0c9 (patch) | |
tree | d7c380ef8c07002fd5412072881b8678d9d8c114 /src | |
parent | 1e1285926f35558f8ad1dad5fad2040ce576f46e (diff) | |
download | android-node-v8-6265e4166aa7a7a7697d52f3a528f3372226b0c9.tar.gz android-node-v8-6265e4166aa7a7a7697d52f3a528f3372226b0c9.tar.bz2 android-node-v8-6265e4166aa7a7a7697d52f3a528f3372226b0c9.zip |
src: fix ESM path resolution on Windows
Windows has some reserved file names such as "con", "prn",
"nul", etc. Such files can be accessed only if the path is
prefixed with "\\.\"
PR-URL: https://github.com/nodejs/node/pull/29574
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/module_wrap.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 4a572c00e1..2d0829860c 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -488,7 +488,12 @@ enum DescriptorType { // Nothing for the "null" cache entries. inline Maybe<uv_file> OpenDescriptor(const std::string& path) { uv_fs_t fs_req; +#ifdef _WIN32 + std::string pth = "\\\\.\\" + path; + uv_file fd = uv_fs_open(nullptr, &fs_req, pth.c_str(), O_RDONLY, 0, nullptr); +#else uv_file fd = uv_fs_open(nullptr, &fs_req, path.c_str(), O_RDONLY, 0, nullptr); +#endif uv_fs_req_cleanup(&fs_req); if (fd < 0) return Nothing<uv_file>(); return Just(fd); |