diff --git a/src/eepp/system/filesystem.cpp b/src/eepp/system/filesystem.cpp index 92fb28f47..4c43d6bf6 100644 --- a/src/eepp/system/filesystem.cpp +++ b/src/eepp/system/filesystem.cpp @@ -197,7 +197,11 @@ bool FileSystem::fileWrite( const std::string& filepath, const std::string& data } bool FileSystem::fileRemove( const std::string& filepath ) { +#if EE_PLATFORM == EE_PLATFORM_WIN + return DeleteFile( String( filepath ).toWideString().c_str() ); +#else return 0 == remove( filepath.c_str() ); +#endif } Uint32 FileSystem::fileGetModificationDate( const std::string& filepath ) { @@ -295,17 +299,13 @@ bool FileSystem::isDirectory( const std::string& path ) { } static inline bool eepp_mkdir( const std::string& path, const Uint16& mode ) { - int v; #if EE_PLATFORM == EE_PLATFORM_WIN -#ifdef EE_COMPILER_MSVC - v = _mkdir( path.c_str() ); -#else - v = mkdir( path.c_str() ); -#endif + return 0 != CreateDirectory( String( path ).toWideString().c_str(), NULL ); #else + int v; v = mkdir( path.c_str(), mode ); -#endif return v == 0; +#endif } bool FileSystem::makeDir( const std::string& path, bool recursive, const Uint16& mode ) { diff --git a/src/thirdparty/efsw b/src/thirdparty/efsw index 12773bb62..4a3a3a5fd 160000 --- a/src/thirdparty/efsw +++ b/src/thirdparty/efsw @@ -1 +1 @@ -Subproject commit 12773bb62ab1e4c0e630e38c58533636a58aefac +Subproject commit 4a3a3a5fdd65c584d8ed9415dfbffcec088527c3 diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 408a5722b..a5442c78d 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -1946,6 +1946,14 @@ UIMessageBox* App::newInputMsgBox( const String& title, const String& msg ) { return msgBox; } +static void fsRenameFile( const std::string& fpath, const std::string& newFilePath ) { +#if EE_PLATFORM == EE_PLATFORM_WIN + fs::rename( String( fpath ).toWideString(), String(newFilePath).toWideString() ); +#else + fs::rename( fpath, newFilePath ); +#endif +} + void App::renameFile( const FileInfo& file ) { if ( !file.exists() ) return; @@ -1960,7 +1968,7 @@ void App::renameFile( const FileInfo& file ) { std::string fpath( file.getFilepath() ); if ( file.isDirectory() ) FileSystem::dirRemoveSlashAtEnd( fpath ); - fs::rename( fpath, newFilePath ); + fsRenameFile( fpath, newFilePath ); } catch ( const fs::filesystem_error& err ) { errorMsgBox( i18n( "error_renaming_file", "Error renaming file." ) ); } diff --git a/src/tools/ecode/filesystemlistener.cpp b/src/tools/ecode/filesystemlistener.cpp index a7b05b304..ca31de14e 100644 --- a/src/tools/ecode/filesystemlistener.cpp +++ b/src/tools/ecode/filesystemlistener.cpp @@ -70,6 +70,7 @@ void FileSystemListener::handleFileAction( efsw::WatchID, const std::string& dir notifyMove( oldFile, file ); } } + break; } case efsw::Actions::Modified: { if ( file.isLink() ) diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp index e0f17184f..41c41049e 100644 --- a/src/tools/ecode/settingsmenu.cpp +++ b/src/tools/ecode/settingsmenu.cpp @@ -1447,6 +1447,14 @@ void SettingsMenu::createProjectTreeMenu() { showProjectTreeMenu(); } +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 +} + void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { if ( mProjectTreeMenu && mProjectTreeMenu->isVisible() ) mProjectTreeMenu->close(); @@ -1548,7 +1556,7 @@ void SettingsMenu::createProjectTreeMenu( const FileInfo& file ) { try { std::string fpath( file.getFilepath() ); FileSystem::dirRemoveSlashAtEnd( fpath ); - fs::remove_all( fpath ); + fsRemoveAll( fpath ); } catch ( const fs::filesystem_error& err ) { errFn(); }