| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6206a8e commit aee45e2
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,10 +27,13 @@ | |||
| 27 | 27 | #include <cmath> | |
| 28 | 28 | #include <cstring> | |
| 29 | 29 | #include <locale> | |
| 30 | - #include <regex> // NOLINT(build/c++11) | ||
| 31 | 30 | #include "node_revert.h" | |
| 32 | 31 | #include "util.h" | |
| 33 | 32 | ||
| 33 | + #ifdef _WIN32 | ||
| 34 | + #include <regex> // NOLINT(build/c++11) | ||
| 35 | + #endif // _WIN32 | ||
| 36 | + | ||
| 34 | 37 | #define CHAR_TEST(bits, name, expr) \ | |
| 35 | 38 | template <typename T> \ | |
| 36 | 39 | bool name(const T ch) { \ | |
@@ -568,9 +571,8 @@ constexpr std::string_view FastStringKey::as_string_view() const { | |||
| 568 | 571 | return name_; | |
| 569 | 572 | } | |
| 570 | 573 | ||
| 571 | - // Inline so the compiler can fully optimize it away on Unix platforms. | ||
| 572 | - bool IsWindowsBatchFile(const char* filename) { | ||
| 573 | 574 | #ifdef _WIN32 | |
| 575 | + inline bool IsWindowsBatchFile(const char* filename) { | ||
| 574 | 576 | std::string file_with_extension = filename; | |
| 575 | 577 | // Regex to match the last extension part after the last dot, ignoring | |
| 576 | 578 | // trailing spaces and dots | |
@@ -583,12 +585,8 @@ bool IsWindowsBatchFile(const char* filename) { | |||
| 583 | 585 | } | |
| 584 | 586 | ||
| 585 | 587 | return !extension.empty() && (extension == "cmd" || extension == "bat"); | |
| 586 | - #else | ||
| 587 | - return false; | ||
| 588 | - #endif // _WIN32 | ||
| 589 | 588 | } | |
| 590 | 589 | ||
| 591 | - #ifdef _WIN32 | ||
| 592 | 590 | inline std::wstring ConvertToWideString(const std::string& str, | |
| 593 | 591 | UINT code_page) { | |
| 594 | 592 | int size_needed = MultiByteToWideChar( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1021,9 +1021,12 @@ v8::Maybe<int> GetValidFileMode(Environment* env, | |||
| 1021 | 1021 | v8::Local<v8::Value> input, | |
| 1022 | 1022 | uv_fs_type type); | |
| 1023 | 1023 | ||
| 1024 | + #ifdef _WIN32 | ||
| 1024 | 1025 | // Returns true if OS==Windows and filename ends in .bat or .cmd, | |
| 1025 | 1026 | // case insensitive. | |
| 1026 | 1027 | inline bool IsWindowsBatchFile(const char* filename); | |
| 1028 | + inline std::wstring ConvertToWideString(const std::string& str, UINT code_page); | ||
| 1029 | + #endif // _WIN32 | ||
| 1027 | 1030 | ||
| 1028 | 1031 | } // namespace node | |
| 1029 | 1032 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments