| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,6 +89,10 @@ bool StartsWith(const std::string& str, std::string_view prefix) { | |||
| 89 | 89 | return str.compare(0, prefix_len, prefix) == 0; | |
| 90 | 90 | } | |
| 91 | 91 | ||
| 92 | + bool FilenameIsConfigGypi(const std::string& path) { | ||
| 93 | + return path == "config.gypi" || EndsWith(path, "/config.gypi"); | ||
| 94 | + } | ||
| 95 | + | ||
| 92 | 96 | typedef std::vector<std::string> FileList; | |
| 93 | 97 | typedef std::map<std::string, FileList> FileMap; | |
| 94 | 98 | ||
@@ -707,7 +711,7 @@ int JS2C(const FileList& js_files, | |||
| 707 | 711 | } | |
| 708 | 712 | } | |
| 709 | 713 | ||
| 710 | - assert(config == "config.gypi"); | ||
| 714 | + assert(FilenameIsConfigGypi(config)); | ||
| 711 | 715 | // "config.gypi" -> config_raw. | |
| 712 | 716 | int r = AddGypi("config", config, &definitions); | |
| 713 | 717 | if (r != 0) { | |
@@ -789,10 +793,9 @@ int Main(int argc, char* argv[]) { | |||
| 789 | 793 | // Should have exactly 3 types: `.js`, `.mjs` and `.gypi`. | |
| 790 | 794 | assert(file_map.size() == 3); | |
| 791 | 795 | auto gypi_it = file_map.find(".gypi"); | |
| 792 | - std::string config = "config.gypi"; | ||
| 793 | 796 | // Currently config.gypi is the only `.gypi` file allowed | |
| 794 | 797 | if (gypi_it == file_map.end() || gypi_it->second.size() != 1 || | |
| 795 | - gypi_it->second[0] != config) { | ||
| 798 | + !FilenameIsConfigGypi(gypi_it->second[0])) { | ||
| 796 | 799 | fprintf( | |
| 797 | 800 | stderr, | |
| 798 | 801 | "Arguments should contain one and only one .gypi file: config.gypi\n"); | |
@@ -805,7 +808,7 @@ int Main(int argc, char* argv[]) { | |||
| 805 | 808 | std::sort(js_it->second.begin(), js_it->second.end()); | |
| 806 | 809 | std::sort(mjs_it->second.begin(), mjs_it->second.end()); | |
| 807 | 810 | ||
| 808 | - return JS2C(js_it->second, mjs_it->second, config, output); | ||
| 811 | + return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output); | ||
| 809 | 812 | } | |
| 810 | 813 | } // namespace js2c | |
| 811 | 814 | } // namespace node | |
| Back | FazBrowse Home | New Git URL |
0 commit comments