MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / BuildOSPath

Method BuildOSPath

neo/framework/FileSystem.cpp:792–828  ·  view source on GitHub ↗

=================== idFileSystemLocal::BuildOSPath =================== */

Source from the content-addressed store, hash-verified

790===================
791*/
792const char *idFileSystemLocal::BuildOSPath( const char *base, const char *game, const char *relativePath ) {
793 static char OSPath[MAX_STRING_CHARS];
794 idStr newPath;
795
796 if ( fs_caseSensitiveOS.GetBool() || com_developer.GetBool() ) {
797 // extract the path, make sure it's all lowercase
798 idStr testPath, fileName;
799
800 sprintf( testPath, "%s/%s", game , relativePath );
801 testPath.StripFilename();
802
803 if ( testPath.HasUpper() ) {
804
805 common->DPrintf( "Non-portable: path contains uppercase characters: %s\n", testPath.c_str() );
806
807 // attempt a fixup on the fly
808 if ( fs_caseSensitiveOS.GetBool() ) {
809 testPath.ToLower();
810 fileName = relativePath;
811 fileName.StripPath();
812 sprintf( newPath, "%s/%s/%s", base, testPath.c_str(), fileName.c_str() );
813 ReplaceSeparators( newPath );
814 common->DPrintf( "Fixed up to %s\n", newPath.c_str() );
815 idStr::Copynz( OSPath, newPath, sizeof( OSPath ) );
816 return OSPath;
817 }
818 }
819 }
820
821 idStr strBase = base;
822 strBase.StripTrailing( '/' );
823 strBase.StripTrailing( '\\' );
824 sprintf( newPath, "%s/%s/%s", strBase.c_str(), game, relativePath );
825 ReplaceSeparators( newPath );
826 idStr::Copynz( OSPath, newPath, sizeof( OSPath ) );
827 return OSPath;
828}
829
830/*
831================

Callers 2

WriteCDKeyMethod · 0.80
OpenURLMethod · 0.80

Calls 7

sprintfFunction · 0.85
ToLowerMethod · 0.80
StripTrailingMethod · 0.80
HasUpperMethod · 0.60
GetBoolMethod · 0.45
DPrintfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected