MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / robust_fopen

Function robust_fopen

Source/Scripting/scriptfile.cpp:125–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125static FILE* robust_fopen(const char* path, const char* mode, int max_tries = 10) {
126 int tries = 0;
127 FILE* file = my_fopen(path, mode);
128 while (file == NULL && tries < max_tries) {
129 file = my_fopen(path, mode);
130 if (file == NULL) {
131 tries++;
132 BusyWaitMilliseconds(50);
133 }
134 }
135 return file;
136}
137
138static std::string ReadScriptFile(const Path& path) {
139 int max_tries = 10;

Callers 1

ReadScriptFileFunction · 0.85

Calls 2

my_fopenFunction · 0.85
BusyWaitMillisecondsFunction · 0.85

Tested by

no test coverage detected