本文整理汇总了C++中Platform::Is_Directory方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::Is_Directory方法的具体用法?C++ Platform::Is_Directory怎么用?C++ Platform::Is_Directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::Is_Directory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Directory_To_Output_Directory
std::string ResourceCompiler::Directory_To_Output_Directory(std::string directory)
{
Platform* platform = Platform::Get();
std::string path = Platform::Get()->Join_Path(".compiled", directory);
if (!platform->Is_Directory(path.c_str()))
{
platform->Create_Directory(path.c_str(), true);
}
return path;
}
示例2: ExceptionHandler
LONG WINAPI ExceptionHandler(struct _EXCEPTION_POINTERS *exceptionInfo)
{
Platform* platform = Platform::Get();
std::string dump_dir = platform->Get_Working_Dir() + "\\.crashes";
std::string dump_path = dump_dir + "\\00000000.dmp";
DBG_LOG("~~~~~~~~~~~~ UNHANDLED EXCEPTION OCCURRED ~~~~~~~~~~~");
// Make sure dump file exists.
if (!platform->Is_Directory(dump_dir.c_str()))
{
DBG_LOG("Attempt to create dump folder ...");
DBG_LOG("Path: %s", dump_dir.c_str());
if (!platform->Create_Directory(dump_dir.c_str(), true))
{
DBG_LOG("Failed to create dump folder. Aborting.");
exit(0);
}
}
// Find somewhere to dump the file.
unsigned int index = 0;
do
{
dump_path = dump_dir + "\\" + StringHelper::To_String(index) + ".dmp";
index++;
} while (platform->Is_File(dump_path.c_str()));
// Dump the file!
DBG_LOG("Attempt to create dump file ...");
DBG_LOG("Path: %s", dump_path.c_str());
HANDLE fileHandle = CreateFileA(dump_path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle == NULL)
{
DBG_LOG("Failed to create open dump file. Aborting.");
exit(0);
}
// Duuuuuuuuump.
HANDLE process = GetCurrentProcess();
MINIDUMP_EXCEPTION_INFORMATION exceptionParam;
exceptionParam.ThreadId = GetCurrentThreadId();
exceptionParam.ExceptionPointers = exceptionInfo;
exceptionParam.ClientPointers = FALSE;
EnterCriticalSection(&g_dbghelp_critical_section);
BOOL result = MiniDumpWriteDump(process,
GetCurrentProcessId(),
fileHandle,
MiniDumpNormal,
exceptionInfo == NULL ? NULL : &exceptionParam,
NULL,
NULL);
LeaveCriticalSection(&g_dbghelp_critical_section);
// Close the dump file handle.
CloseHandle(fileHandle);
// Check a file was created.
if (result == FALSE)
{
u32 ec = GetLastError();
DBG_LOG("Failed to create dump file, GetLastError()=%i (%s)", ec, FormatSystemError(ec).c_str());
}
else
{
DBG_LOG("Success!");
}
// Dump stack trace.
DBG_LOG("");
DBG_LOG("Call Stack:");
StackFrame frames[256];
int frameCount = platform->Get_Stack_Trace(frames, 256, exceptionInfo);
for (int i = 0; i < frameCount; i++)
{
StackFrame& frame = frames[i];
platform->Resolve_Stack_Frame_Info(frame);
DBG_LOG("[%i] %s (%i): %s", i, frame.File, frame.Line, frame.Name);
}
DBG_LOG("");
// Bail the fuck out.
// We use this to long jump back to the point after PlatformMain is called
// so we can deinitialize everything.
if (GetCurrentThreadId() == g_main_thread_id)
{
DBG_LOG("Attempting recovery through longjmp ...");
longjmp(g_error_recovery_longjmp, 1);
}
//.........这里部分代码省略.........