| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ec44965 commit 7940db7
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | #include <cerrno> | |
| 2 | 2 | #include <cstdarg> | |
| 3 | + #include <filesystem> | ||
| 3 | 4 | #include <sstream> | |
| 4 | 5 | ||
| 5 | 6 | #include "debug_utils-inl.h" | |
@@ -538,10 +539,11 @@ static void ReportFatalException(Environment* env, | |||
| 538 | 539 | std::string argv0; | |
| 539 | 540 | if (!env->argv().empty()) argv0 = env->argv()[0]; | |
| 540 | 541 | if (argv0.empty()) argv0 = "node"; | |
| 542 | + auto filesystem_path = std::filesystem::path(argv0).replace_extension(); | ||
| 541 | 543 | FPrintF(stderr, | |
| 542 | 544 | "(Use `%s --trace-uncaught ...` to show where the exception " | |
| 543 | 545 | "was thrown)\n", | |
| 544 | - fs::Basename(argv0, ".exe")); | ||
| 546 | + filesystem_path.filename().string()); | ||
| 545 | 547 | } | |
| 546 | 548 | } | |
| 547 | 549 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,29 +82,6 @@ constexpr char kPathSeparator = '/'; | |||
| 82 | 82 | const char* const kPathSeparator = "\\/"; | |
| 83 | 83 | #endif | |
| 84 | 84 | ||
| 85 | - std::string Basename(const std::string& str, const std::string& extension) { | ||
| 86 | - // Remove everything leading up to and including the final path separator. | ||
| 87 | - std::string::size_type pos = str.find_last_of(kPathSeparator); | ||
| 88 | - | ||
| 89 | - // Starting index for the resulting string | ||
| 90 | - std::size_t start_pos = 0; | ||
| 91 | - // String size to return | ||
| 92 | - std::size_t str_size = str.size(); | ||
| 93 | - if (pos != std::string::npos) { | ||
| 94 | - start_pos = pos + 1; | ||
| 95 | - str_size -= start_pos; | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - // Strip away the extension, if any. | ||
| 99 | - if (str_size >= extension.size() && | ||
| 100 | - str.compare(str.size() - extension.size(), | ||
| 101 | - extension.size(), extension) == 0) { | ||
| 102 | - str_size -= extension.size(); | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - return str.substr(start_pos, str_size); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | 85 | inline int64_t GetOffset(Local<Value> value) { | |
| 109 | 86 | return IsSafeJsInt(value) ? value.As<Integer>()->Value() : -1; | |
| 110 | 87 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -415,10 +415,6 @@ BaseObjectPtr<AsyncWrap> CreateHeapSnapshotStream( | |||
| 415 | 415 | Environment* env, HeapSnapshotPointer&& snapshot); | |
| 416 | 416 | } // namespace heap | |
| 417 | 417 | ||
| 418 | - namespace fs { | ||
| 419 | - std::string Basename(const std::string& str, const std::string& extension); | ||
| 420 | - } // namespace fs | ||
| 421 | - | ||
| 422 | 418 | node_module napi_module_to_node_module(const napi_module* mod); | |
| 423 | 419 | ||
| 424 | 420 | std::ostream& operator<<(std::ostream& output, const SnapshotFlags& flags); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments