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

Function mod_GetRealModuleName

module/module.cpp:278–310  ·  view source on GitHub ↗

Returns the real name of the module. If a given file has an extension, it will just return that filename. If the given file has no given extension, the system specific extension is concatted and returned.

Source from the content-addressed store, hash-verified

276// just return that filename. If the given file has no given extension, the
277// system specific extension is concatted and returned.
278void mod_GetRealModuleName(const char *modfilename, char *realmodfilename) {
279 char pathname[_MAX_PATH], filename[_MAX_FNAME], extension[_MAX_EXT];
280 dd_SplitPath(modfilename, pathname, filename, extension);
281 if (*extension == '\0')
282#if defined(WIN32)
283 strcat(filename, ".dll");
284#elif defined(__LINUX__)
285 strcat(filename, ".so");
286#elif defined(MACOSX)
287 strcat(filename, ".dylib");
288#else
289 #error Unsupported platform!
290#endif
291 else {
292#if defined(WIN32)
293 if (!stricmp(extension, ".so") || !stricmp(extension, "msl") || !stricmp(extension, "dylib"))
294 strcat(filename, ".dll");
295 else
296 strcat(filename, extension);
297#elif defined(__LINUX__)
298 if (!stricmp(extension, ".dll") || !stricmp(extension, "msl") || !stricmp(extension, "dylib"))
299 strcat(filename, ".so");
300 else
301 strcat(filename, extension);
302#elif defined(MACOSX)
303 if (!stricmp(extension, ".dll") || !stricmp(extension, "msl") || !stricmp(extension, "so"))
304 strcat(filename, ".dylib");
305 else
306 strcat(filename, extension);
307#else
308 #error Unsupported platform!
309#endif
310 }
311 if (*pathname != '\0')
312 dd_MakePath(realmodfilename, pathname, filename, NULL);
313 else

Callers 2

mod_LoadModuleFunction · 0.85
_get_full_path_to_moduleFunction · 0.85

Calls 1

dd_SplitPathFunction · 0.85

Tested by

no test coverage detected