* 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. */
| 90 | * @return Directory has been found. |
| 91 | */ |
| 92 | static 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. */ |
| 110 | void Micropolis::environmentInit() |