MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ddio_MakePath

Function ddio_MakePath

ddio/winfile.cpp:239–272  ·  view source on GitHub ↗

Constructs a path in the local file system's syntax newPath: stores the constructed path absolutePathHeader: absolute path on which the sub directories will be appended (specified in local file system syntax) takes a variable number of subdirectories which will be concatenated on to the path the last argument in the list of sub dirs *MUST* be NULL to terminate the list

Source from the content-addressed store, hash-verified

237// takes a variable number of subdirectories which will be concatenated on to the path
238// the last argument in the list of sub dirs *MUST* be NULL to terminate the list
239void ddio_MakePath(char *newPath, const char *absolutePathHeader, const char *subDir, ...) {
240 const char delimiter = '\\';
241 va_list args;
242 char *currentDir = NULL;
243 int pathLength = 0;
244
245 assert(newPath);
246 assert(absolutePathHeader);
247 assert(subDir);
248
249 if (newPath != absolutePathHeader) {
250 strcpy(newPath, absolutePathHeader);
251 }
252
253 // Add the first sub directory
254 pathLength = strlen(newPath);
255 if (newPath[pathLength - 1] != delimiter) {
256 newPath[pathLength] = delimiter; // add the delimiter
257 newPath[pathLength + 1] = 0; // terminate the string
258 }
259 strcat(newPath, subDir);
260
261 // Add the additional subdirectories
262 va_start(args, subDir);
263 while ((currentDir = va_arg(args, char *)) != NULL) {
264 pathLength = strlen(newPath);
265 if (newPath[pathLength - 1] != delimiter) {
266 newPath[pathLength] = delimiter; // add the delimiter
267 newPath[pathLength + 1] = 0; // terminate the string
268 }
269 strcat(newPath, currentDir);
270 }
271 va_end(args);
272}
273
274bool ddio_GetTempFileName(const char *basedir, const char *prefix, char *filename) {
275

Callers 15

ddio_GetParentPathFunction · 0.70
mng_IsNetworkUpFunction · 0.50
mng_InitLocalTablesFunction · 0.50
mng_InitNetTablesFunction · 0.50
BuildOldFileListFunction · 0.50
QuitMethod · 0.50
CopyScriptFileFunction · 0.50
OnNewDocumentMethod · 0.50
OnCompileMethod · 0.50
OnEditscriptMethod · 0.50
OnCreatescriptMethod · 0.50
AddNewGameFileFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected