| 1191 | } |
| 1192 | |
| 1193 | bool executeFile(const char* fileName, bool noCalls, bool journalScript) |
| 1194 | { |
| 1195 | bool journal = false; |
| 1196 | |
| 1197 | char scriptFilenameBuffer[1024]; |
| 1198 | U32 execDepth = 0; |
| 1199 | U32 journalDepth = 1; |
| 1200 | |
| 1201 | execDepth++; |
| 1202 | if (journalDepth >= execDepth) |
| 1203 | journalDepth = execDepth + 1; |
| 1204 | else |
| 1205 | journal = true; |
| 1206 | |
| 1207 | bool ret = false; |
| 1208 | |
| 1209 | if (journalScript && !journal) |
| 1210 | { |
| 1211 | journal = true; |
| 1212 | journalDepth = execDepth; |
| 1213 | } |
| 1214 | |
| 1215 | // Determine the filename we actually want... |
| 1216 | Con::expandScriptFilename(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), fileName); |
| 1217 | |
| 1218 | // since this function expects a script file reference, if it's a .dso |
| 1219 | // lets terminate the string before the dso so it will act like a .tscript |
| 1220 | if (dStrEndsWith(scriptFilenameBuffer, ".dso")) |
| 1221 | { |
| 1222 | scriptFilenameBuffer[dStrlen(scriptFilenameBuffer) - dStrlen(".dso")] = '\0'; |
| 1223 | } |
| 1224 | |
| 1225 | // Figure out where to put DSOs |
| 1226 | StringTableEntry dsoPath = Con::getDSOPath(scriptFilenameBuffer); |
| 1227 | |
| 1228 | const char *ext = dStrrchr(scriptFilenameBuffer, '.'); |
| 1229 | |
| 1230 | if (!ext) |
| 1231 | { |
| 1232 | // Try appending the default script extension and see if that succeeds |
| 1233 | |
| 1234 | if (executeFile(fileName + String("." TORQUE_SCRIPT_EXTENSION), noCalls, journalScript)) |
| 1235 | { |
| 1236 | return true; |
| 1237 | } |
| 1238 | |
| 1239 | // We need an extension! |
| 1240 | Con::errorf(ConsoleLogEntry::Script, "exec: invalid script file name %s.", scriptFilenameBuffer); |
| 1241 | execDepth--; |
| 1242 | return false; |
| 1243 | } |
| 1244 | |
| 1245 | // Check Editor Extensions |
| 1246 | bool isEditorScript = false; |
| 1247 | |
| 1248 | // If the script file extension is '.ed.tscript' then compile it to a different compiled extension |
| 1249 | if (dStricmp(ext, "." TORQUE_SCRIPT_EXTENSION) == 0) |
| 1250 | { |
no test coverage detected