=================== idFileSystemLocal::BuildOSPath =================== */
| 790 | =================== |
| 791 | */ |
| 792 | const 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 | ================ |