end of the function PC_ConvertPath ============================================================================ Parameter: - Returns: - Changes Globals: - ============================================================================
| 989 | // Changes Globals: - |
| 990 | //============================================================================ |
| 991 | int PC_Directive_include(source_t *source) |
| 992 | { |
| 993 | script_t *script; |
| 994 | token_t token; |
| 995 | char path[MAX_PATH]; |
| 996 | #ifdef QUAKE |
| 997 | foundfile_t file; |
| 998 | #endif //QUAKE |
| 999 | |
| 1000 | if (source->skip > 0) return qtrue; |
| 1001 | // |
| 1002 | if (!PC_ReadSourceToken(source, &token)) |
| 1003 | { |
| 1004 | SourceError(source, "#include without file name"); |
| 1005 | return qfalse; |
| 1006 | } //end if |
| 1007 | if (token.linescrossed > 0) |
| 1008 | { |
| 1009 | SourceError(source, "#include without file name"); |
| 1010 | return qfalse; |
| 1011 | } //end if |
| 1012 | if (token.type == TT_STRING) |
| 1013 | { |
| 1014 | StripDoubleQuotes(token.string); |
| 1015 | PC_ConvertPath(token.string); |
| 1016 | script = LoadScriptFile(token.string); |
| 1017 | if (!script) |
| 1018 | { |
| 1019 | Q_strncpyz(path, source->includepath, sizeof(path)); |
| 1020 | Q_strcat(path, sizeof(path), token.string); |
| 1021 | script = LoadScriptFile(path); |
| 1022 | } //end if |
| 1023 | } //end if |
| 1024 | else if (token.type == TT_PUNCTUATION && *token.string == '<') |
| 1025 | { |
| 1026 | Q_strncpyz(path, source->includepath, sizeof(path)); |
| 1027 | while(PC_ReadSourceToken(source, &token)) |
| 1028 | { |
| 1029 | if (token.linescrossed > 0) |
| 1030 | { |
| 1031 | PC_UnreadSourceToken(source, &token); |
| 1032 | break; |
| 1033 | } //end if |
| 1034 | if (token.type == TT_PUNCTUATION && *token.string == '>') break; |
| 1035 | Q_strcat(path, sizeof(path), token.string); |
| 1036 | } //end while |
| 1037 | if (*token.string != '>') |
| 1038 | { |
| 1039 | SourceWarning(source, "#include missing trailing >"); |
| 1040 | } //end if |
| 1041 | if (!strlen(path)) |
| 1042 | { |
| 1043 | SourceError(source, "#include without file name between < >"); |
| 1044 | return qfalse; |
| 1045 | } //end if |
| 1046 | PC_ConvertPath(path); |
| 1047 | script = LoadScriptFile(path); |
| 1048 | } //end if |
nothing calls this directly
no test coverage detected