Fix recursive directory removal across platforms

Add FileSystem::dirRemoveAll() to normalize trailing separators and use the non-throwing std::filesystem::remove_all overload.

Migrate ecode and unit-test cleanup call sites to the centralized helper, preventing Haiku from crashing when removing directories with trailing slashes during shutdown.
This commit is contained in:
Martín Lucas Golini
2026-08-18 13:37:56 -03:00
parent 1b2927e129
commit 01ebd7a82d
8 changed files with 43 additions and 43 deletions
+2 -9
View File
@@ -1046,14 +1046,6 @@ App::App( const size_t& jobs, const std::vector<std::string>& args ) :
mFontPickerController( std::make_unique<FontPickerController>( this ) ),
mSettingsActions( std::make_unique<SettingsActions>( this ) ) {}
static void fsRemoveAll( const std::string& fpath ) {
#if EE_PLATFORM == EE_PLATFORM_WIN
fs::remove_all( std::filesystem::path( String( fpath ).toWideString() ) );
#else
fs::remove_all( fpath );
#endif
}
App::~App() {
appInstance = nullptr;
mDestroyingApp = true;
@@ -1082,7 +1074,8 @@ App::~App() {
}
mDirTree.reset();
fsRemoveAll( mPidPath );
if ( !FileSystem::dirRemoveAll( mPidPath ) )
Log::warning( "Failed to remove directory \"%s\"", mPidPath );
if ( mFirstInstance )
FileSystem::fileRemove( firstInstanceIndicatorPath() );