@@ -842,19 +842,6 @@ void AfterOpenFileHandle(uv_fs_t* req) { |
842 | 842 | } |
843 | 843 | } |
844 | 844 |
|
845 | | -// Reverse the logic applied by path.toNamespacedPath() to create a |
846 | | -// namespace-prefixed path. |
847 | | -void FromNamespacedPath(std::string* path) { |
848 | | -#ifdef _WIN32 |
849 | | - if (path->compare(0, 8, "\\\\?\\UNC\\", 8) == 0) { |
850 | | - *path = path->substr(8); |
851 | | - path->insert(0, "\\\\"); |
852 | | - } else if (path->compare(0, 4, "\\\\?\\", 4) == 0) { |
853 | | - *path = path->substr(4); |
854 | | - } |
855 | | -#endif |
856 | | -} |
857 | | - |
858 | 845 | void AfterMkdirp(uv_fs_t* req) { |
859 | 846 | FSReqBase* req_wrap = FSReqBase::from_req(req); |
860 | 847 | FSReqAfterScope after(req_wrap, req); |
@@ -864,7 +851,7 @@ void AfterMkdirp(uv_fs_t* req) { |
864 | 851 | std::string first_path(req_wrap->continuation_data()->first_path()); |
865 | 852 | if (first_path.empty()) |
866 | 853 | return req_wrap->Resolve(Undefined(req_wrap->env()->isolate())); |
867 | | - FromNamespacedPath(&first_path); |
| 854 | + node::url::FromNamespacedPath(&first_path); |
868 | 855 | Local<Value> path; |
869 | 856 | Local<Value> error; |
870 | 857 | if (!StringBytes::Encode(req_wrap->env()->isolate(), first_path.c_str(), |
@@ -1825,7 +1812,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) { |
1825 | 1812 | if (!req_wrap_sync.continuation_data()->first_path().empty()) { |
1826 | 1813 | Local<Value> error; |
1827 | 1814 | std::string first_path(req_wrap_sync.continuation_data()->first_path()); |
1828 | | - FromNamespacedPath(&first_path); |
| 1815 | + node::url::FromNamespacedPath(&first_path); |
1829 | 1816 | MaybeLocal<Value> path = StringBytes::Encode(env->isolate(), |
1830 | 1817 | first_path.c_str(), |
1831 | 1818 | UTF8, &error); |
@@ -2935,7 +2922,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { |
2935 | 2922 | return; |
2936 | 2923 | } |
2937 | 2924 |
|
2938 | | - FromNamespacedPath(&initial_file_path.value()); |
| 2925 | + node::url::FromNamespacedPath(&initial_file_path.value()); |
2939 | 2926 |
|
2940 | 2927 | for (int i = 0; i < legacy_main_extensions_with_main_end; i++) { |
2941 | 2928 | file_path = *initial_file_path + std::string(legacy_main_extensions[i]); |
@@ -2970,7 +2957,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { |
2970 | 2957 | return; |
2971 | 2958 | } |
2972 | 2959 |
|
2973 | | - FromNamespacedPath(&initial_file_path.value()); |
| 2960 | + node::url::FromNamespacedPath(&initial_file_path.value()); |
2974 | 2961 |
|
2975 | 2962 | for (int i = legacy_main_extensions_with_main_end; |
2976 | 2963 | i < legacy_main_extensions_package_fallback_end; |
|