| 1139 | } |
| 1140 | |
| 1141 | bool executeFile(const char* fileName, bool noCalls, bool journalScript) |
| 1142 | { |
| 1143 | bool journal = false; |
| 1144 | |
| 1145 | char scriptFilenameBuffer[1024]; |
| 1146 | U32 execDepth = 0; |
| 1147 | U32 journalDepth = 1; |
| 1148 | |
| 1149 | execDepth++; |
| 1150 | if (journalDepth >= execDepth) |
| 1151 | journalDepth = execDepth + 1; |
| 1152 | else |
| 1153 | journal = true; |
| 1154 | |
| 1155 | bool ret = false; |
| 1156 | |
| 1157 | if (journalScript && !journal) |
| 1158 | { |
| 1159 | journal = true; |
| 1160 | journalDepth = execDepth; |
| 1161 | } |
| 1162 | |
| 1163 | // Determine the filename we actually want... |
| 1164 | Con::expandScriptFilename(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), fileName); |
| 1165 | |
| 1166 | // since this function expects a script file reference, if it's a .dso |
| 1167 | // lets terminate the string before the dso so it will act like a .cs |
| 1168 | if (dStrEndsWith(scriptFilenameBuffer, ".dso")) |
| 1169 | { |
| 1170 | scriptFilenameBuffer[dStrlen(scriptFilenameBuffer) - dStrlen(".dso")] = '\0'; |
| 1171 | } |
| 1172 | |
| 1173 | // Figure out where to put DSOs |
| 1174 | StringTableEntry dsoPath = Con::getDSOPath(scriptFilenameBuffer); |
| 1175 | |
| 1176 | const char *ext = dStrrchr(scriptFilenameBuffer, '.'); |
| 1177 | |
| 1178 | if (!ext) |
| 1179 | { |
| 1180 | // We need an extension! |
| 1181 | Con::errorf(ConsoleLogEntry::Script, "exec: invalid script file name %s.", scriptFilenameBuffer); |
| 1182 | execDepth--; |
| 1183 | return false; |
| 1184 | } |
| 1185 | |
| 1186 | // Check Editor Extensions |
| 1187 | bool isEditorScript = false; |
| 1188 | |
| 1189 | // If the script file extension is '.ed.cs' then compile it to a different compiled extension |
| 1190 | if (dStricmp(ext, ".cs") == 0) |
| 1191 | { |
| 1192 | const char* ext2 = ext - 3; |
| 1193 | if (dStricmp(ext2, ".ed.cs") == 0) |
| 1194 | isEditorScript = true; |
| 1195 | } |
| 1196 | else if (dStricmp(ext, ".gui") == 0) |
| 1197 | { |
| 1198 | const char* ext2 = ext - 3; |
no test coverage detected