| 52 | } |
| 53 | |
| 54 | std::string getDataFilePath(std::string file, bool critical) { |
| 55 | WIN32_FIND_DATA findDataFileData; |
| 56 | HANDLE hFind; |
| 57 | |
| 58 | // Build the path from the file name provided. |
| 59 | std::string path = getRootDirectory().append("\\data\\" + file); |
| 60 | |
| 61 | // Scan the path for the specified data file. |
| 62 | hFind = FindFirstFileA(path.c_str(), &findDataFileData); |
| 63 | |
| 64 | // We couldn't find the data file at the path provided. |
| 65 | if (hFind == INVALID_HANDLE_VALUE) |
| 66 | { |
| 67 | // Is this a critical data file (i.e. a shader)? |
| 68 | if (critical) |
| 69 | { |
| 70 | // Inform the user via a message box and throw a debug break to create a dump file. |
| 71 | LOG_MSG("[aliasIsolation::utilities] FATAL ERROR - Failed to find critical data file at \"%s\"!\n", path.c_str()); |
| 72 | |
| 73 | char buf[256]; |
| 74 | sprintf_s(buf, "FATAL ERROR - Failed to find critical data file \"%s\"!", path.c_str()); |
| 75 | MessageBoxA(NULL, buf, "Alias Isolation", NULL); |
| 76 | |
| 77 | DebugBreak(); |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | // It isn't, continue execution anyway. |
| 82 | LOG_MSG("[aliasIsolation::utilities] Non-fatal Error - Failed to find data file at \"%s\"!\n", path.c_str()); |
| 83 | } |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | LOG_MSG("[aliasIsolation::utilities] Located data file at \"%s\".\n", path.c_str()); |
| 88 | } |
| 89 | |
| 90 | return path; |
| 91 | } |
no test coverage detected