mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-23 03:02:50 +03:00
A couple of minor changes on how we handle the stack-trace saving on Windows (closes SpartanJ/ecode#835).
This commit is contained in:
@@ -176,18 +176,27 @@ class WindowsSignalHandling {
|
||||
}
|
||||
|
||||
static void handle_stacktrace( int skip_frames = 0 ) {
|
||||
const auto appendCrashesPath = []( std::string& crashesPath ) {
|
||||
FileSystem::dirAddSlashAtEnd( crashesPath );
|
||||
crashesPath += "crashes";
|
||||
FileSystem::dirAddSlashAtEnd( crashesPath );
|
||||
};
|
||||
|
||||
std::string crashesPath( Sys::getConfigPath( "ecode" ) );
|
||||
FileSystem::dirAddSlashAtEnd( crashesPath );
|
||||
crashesPath += "crashes";
|
||||
FileSystem::dirAddSlashAtEnd( crashesPath );
|
||||
appendCrashesPath( crashesPath );
|
||||
|
||||
if ( !FileSystem::fileExists( crashesPath ) && !FileSystem::makeDir( crashesPath, true ) ) {
|
||||
crashesPath = Sys::getProcessPath();
|
||||
appendCrashesPath( crashesPath );
|
||||
FileSystem::makeDir( crashesPath, true );
|
||||
}
|
||||
|
||||
std::string dateTimeStr( Sys::getDateTimeStr() );
|
||||
String::replaceAll( dateTimeStr, " ", "_" );
|
||||
String::replaceAll( dateTimeStr, ":", "-" );
|
||||
std::string crashFilePath(
|
||||
String::format( "%sstacktrace_%s.log", crashesPath, dateTimeStr ) );
|
||||
|
||||
FileSystem::makeDir( crashesPath );
|
||||
|
||||
std::ofstream outFile( crashFilePath );
|
||||
if ( !outFile.is_open() ) {
|
||||
print_to_console( "Error: Failed to open " + crashFilePath +
|
||||
|
||||
Reference in New Issue
Block a user