GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: move `FromNamespacedPath` to path.cc · nodejs/node@cc1f497

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_file.cc
    • node_url.cc
    • node_url.h
    • path.cc
    • path.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,7 +3098,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
30983098
return;
30993099
}
31003100

3101-
node::url::FromNamespacedPath(&initial_file_path.value());
3101+
FromNamespacedPath(&initial_file_path.value());
31023102

31033103
for (int i = 0; i < legacy_main_extensions_with_main_end; i++) {
31043104
file_path = *initial_file_path + std::string(legacy_main_extensions[i]);
@@ -3133,7 +3133,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
31333133
return;
31343134
}
31353135

3136-
node::url::FromNamespacedPath(&initial_file_path.value());
3136+
FromNamespacedPath(&initial_file_path.value());
31373137

31383138
for (int i = legacy_main_extensions_with_main_end;
31393139
i < legacy_main_extensions_package_fallback_end;
Collapse file

‎src/node_url.cc‎

Copy file name to clipboardExpand all lines: src/node_url.cc
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -544,19 +544,6 @@ std::optional<std::string> FileURLToPath(Environment* env,
544544
#endif // _WIN32
545545
}
546546

547-
// Reverse the logic applied by path.toNamespacedPath() to create a
548-
// namespace-prefixed path.
549-
void FromNamespacedPath(std::string* path) {
550-
#ifdef _WIN32
551-
if (path->compare(0, 8, "\\\\?\\UNC\\", 8) == 0) {
552-
*path = path->substr(8);
553-
path->insert(0, "\\\\");
554-
} else if (path->compare(0, 4, "\\\\?\\", 4) == 0) {
555-
*path = path->substr(4);
556-
}
557-
#endif
558-
}
559-
560547
} // namespace url
561548

562549
} // namespace node
Collapse file

‎src/node_url.h‎

Copy file name to clipboardExpand all lines: src/node_url.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ void ThrowInvalidURL(Environment* env,
8585
std::string FromFilePath(std::string_view file_path);
8686
std::optional<std::string> FileURLToPath(Environment* env,
8787
const ada::url_aggregator& file_url);
88-
void FromNamespacedPath(std::string* path);
8988

9089
} // namespace url
9190

Collapse file

‎src/path.cc‎

Copy file name to clipboardExpand all lines: src/path.cc
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,17 @@ void ToNamespacedPath(Environment* env, BufferValue* path) {
314314
#endif
315315
}
316316

317+
// Reverse the logic applied by path.toNamespacedPath() to create a
318+
// namespace-prefixed path.
319+
void FromNamespacedPath(std::string* path) {
320+
#ifdef _WIN32
321+
if (path->starts_with("\\\\?\\UNC\\")) {
322+
*path = path->substr(8);
323+
path->insert(0, "\\\\");
324+
} else if (path->starts_with("\\\\?\\")) {
325+
*path = path->substr(4);
326+
}
327+
#endif
328+
}
329+
317330
} // namespace node
Collapse file

‎src/path.h‎

Copy file name to clipboardExpand all lines: src/path.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ constexpr bool IsWindowsDeviceRoot(const char c) noexcept;
2424
#endif // _WIN32
2525

2626
void ToNamespacedPath(Environment* env, BufferValue* path);
27+
void FromNamespacedPath(std::string* path);
2728

2829
} // namespace node
2930

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.