MCPcopy Create free account
hub / github.com/SimHacker/micropolis / testDirectory

Function testDirectory

MicropolisCore/src/MicropolisEngine/src/main.cpp:92–107  ·  view source on GitHub ↗

* Check whether \a dir points to a directory. * If not, report an error. * @param dir Directory to search. * @param envVar Environment variable controlling searchpath of the directory. * @return Directory has been found. */

Source from the content-addressed store, hash-verified

90 * @return Directory has been found.
91 */
92static bool testDirectory(const std::string& dir, const char *envVar)
93{
94 struct stat statbuf;
95
96 if (stat(dir.c_str(), &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) {
97
98 return true;
99 }
100
101 fprintf(stderr, "Can't find the directory \"%s\"!\n", dir.c_str());
102 fprintf(stderr,
103 "The environment variable \"%s\" should name a directory.\n",
104 envVar);
105
106 return false;
107}
108
109/** Locate resource directory. */
110void Micropolis::environmentInit()

Callers 1

environmentInitMethod · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected