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

Method environmentInit

MicropolisCore/src/MicropolisEngine/src/main.cpp:110–131  ·  view source on GitHub ↗

Locate resource directory. */

Source from the content-addressed store, hash-verified

108
109/** Locate resource directory. */
110void 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 */

Callers

nothing calls this directly

Calls 1

testDirectoryFunction · 0.85

Tested by

no test coverage detected