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

Method AddPath

Source/Internal/filesystem.cpp:72–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int Paths::AddPath(const char* path) {
73 RemovePath(path);
74 string withTrailing = SanitizePath(AssemblePath(string(path), string()));
75 if (num_paths < kMaxPaths) {
76 FormatString(paths[num_paths], kPathSize, "%s", withTrailing.c_str());
77 mod_path_ids[num_paths] = CoreGameModID;
78 ++num_paths;
79 return num_paths - 1;
80 } else {
81 LOGE << "All preallocated filesystem paths are utilized, this isn't intended to occur, contact developer." << endl;
82
83 LOGE << "Printing all currently registered paths, are there duplicates, empty or invalid entries?" << endl;
84 for (int i = 0; i < kMaxPaths; i++) {
85 LOGE << i << ":" << paths[i] << endl;
86 }
87
88 LOG_ASSERT(false);
89
90 return -1;
91 }
92}
93
94bool Paths::AddModPath(const char* path, ModID modid) {
95 string withTrailing = SanitizePath(AssemblePath(string(path), string()));

Callers 2

GetDescMethod · 0.45
AddPathFunction · 0.45

Calls 5

RemovePathFunction · 0.85
SanitizePathFunction · 0.85
AssemblePathFunction · 0.85
FormatStringFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected