Stop using FileSystem::fileCanWrite for write access check since it doesn't work on Windows. I couldn't find any reliable way to check this than simply trying to open a file as "wb".

This commit is contained in:
Martín Lucas Golini
2023-09-09 17:17:59 -03:00
parent 689d65f941
commit e479760ec8
6 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -362,7 +362,7 @@ UIFileDialog* App::saveFileDialog( UICodeEditor* editor, bool focusOnClose ) {
if ( editor ) {
std::string path( event->getNode()->asType<UIFileDialog>()->getFullPath() );
if ( !path.empty() && !FileSystem::isDirectory( path ) &&
FileSystem::fileCanWrite( FileSystem::fileRemoveFileName( path ) ) ) {
FileSystem::fileWrite( path, "" ) ) {
if ( editor->getDocument().save( path ) ) {
updateEditorState();
} else {
@@ -2865,7 +2865,7 @@ void App::initProjectTreeView( std::string path, bool openClean ) {
if ( FileSystem::fileExists( rpath ) ) {
loadFileFromPath( rpath, false, nullptr, forcePosition );
} else if ( FileSystem::fileCanWrite( folderPath ) ) {
} else if ( FileSystem::fileWrite( path, "" ) ) {
loadFileFromPath( path, false, nullptr, forcePosition );
}