| 42 | |
| 43 | protected: |
| 44 | static FILE* Open(const char* filename) { |
| 45 | const char *paths[] = { |
| 46 | "encodings", |
| 47 | "bin/encodings", |
| 48 | "../bin/encodings", |
| 49 | "../../bin/encodings", |
| 50 | "../../../bin/encodings" |
| 51 | }; |
| 52 | char buffer[1024]; |
| 53 | for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) { |
| 54 | sprintf(buffer, "%s/%s", paths[i], filename); |
| 55 | FILE *fp = fopen(buffer, "rb"); |
| 56 | if (fp) |
| 57 | return fp; |
| 58 | } |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | static char *ReadFile(const char* filename, bool appendPath, size_t* outLength) { |
| 63 | FILE *fp = appendPath ? Open(filename) : fopen(filename, "rb"); |
nothing calls this directly
no outgoing calls
no test coverage detected