Locate resource directory. */
| 108 | |
| 109 | /** Locate resource directory. */ |
| 110 | void Micropolis::environmentInit() |
| 111 | { |
| 112 | const char *s = getenv("SIMHOME"); |
| 113 | if (s == NULL) { |
| 114 | s = "."; |
| 115 | } |
| 116 | homeDir = s; |
| 117 | |
| 118 | if (testDirectory(homeDir, "$SIMHOME")) { |
| 119 | |
| 120 | resourceDir = homeDir + "/res/"; |
| 121 | if (testDirectory(resourceDir, "$SIMHOME/res")) { |
| 122 | |
| 123 | return; // All ok |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // Failed on $SIMHOME, ".", or the 'res' directory. |
| 128 | fprintf(stderr, |
| 129 | "Please check the environment or reinstall Micropolis and try again! Sorry!\n"); |
| 130 | exit(1); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | /** Initialize for a simulation */ |
nothing calls this directly
no test coverage detected