From d493674363ebdff5aca4e45b53b617fa7509a710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 10 Apr 2024 13:08:17 -0300 Subject: [PATCH] A couple of minor fixes. --- src/eepp/system/filesystem.cpp | 18 +++++------------- src/tools/ecode/plugins/git/gitplugin.cpp | 4 ++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/eepp/system/filesystem.cpp b/src/eepp/system/filesystem.cpp index d6a9bf27b..2074dfec1 100644 --- a/src/eepp/system/filesystem.cpp +++ b/src/eepp/system/filesystem.cpp @@ -22,7 +22,7 @@ #else #include #ifndef S_ISDIR -#define S_ISDIR( mode ) ( ( (mode)&S_IFMT ) == S_IFDIR ) +#define S_ISDIR( mode ) ( ( ( mode ) & S_IFMT ) == S_IFDIR ) #endif #endif @@ -205,8 +205,8 @@ bool FileSystem::fileRemove( const std::string& filepath ) { bool FileSystem::fileHide( const std::string& filepath ) { #if EE_PLATFORM == EE_PLATFORM_WIN - return SetFileAttributesW( (LPCWSTR)String( filepath ).toWideString().c_str(), - FILE_ATTRIBUTE_HIDDEN ); + return SetFileAttributesW( (LPCWSTR)String( filepath ).toWideString().c_str(), + FILE_ATTRIBUTE_HIDDEN ); #elif EE_PLATFORM == EE_PLATFORM_MACOS return 0 == chflags( filepath.c_str(), UF_HIDDEN ); #else @@ -415,16 +415,8 @@ std::vector FileSystem::filesGetInPath( const String& path, const bool& #else if ( strcmp( dirp->d_name, ".." ) != 0 && strcmp( dirp->d_name, "." ) != 0 ) { #endif - char* p = &dirp->d_name[0]; - String tmp; - - while ( *p ) { - unsigned char y = *p; - tmp.push_back( y ); - p++; - } - - files.push_back( tmp ); + files.push_back( + String::fromUtf8( std::string_view{ dirp->d_name, strlen( dirp->d_name ) } ) ); } } diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index 22cdec0bc..3c00c2a1f 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -1069,7 +1069,7 @@ void GitPlugin::diff( const Git::DiffMode mode, const std::string& repoPath ) { break; } doc->setDefaultFileName( repoName + "-" + modeName + ".diff" ); - doc->setSyntaxDefinition( SyntaxDefinitionManager::instance()->getByLSPName( "diff" ) ); + ret.second->setSyntaxDefinition( SyntaxDefinitionManager::instance()->getByLSPName( "diff" ) ); doc->textInput( res.result, false ); doc->moveToStartOfDoc(); doc->resetUndoRedo(); @@ -1087,7 +1087,7 @@ void GitPlugin::diff( const std::string& file, bool isStaged ) { auto ret = mManager->getSplitter()->createEditorInNewTab(); auto doc = ret.second->getDocumentRef(); doc->setDefaultFileName( FileSystem::fileNameFromPath( file ) + ".diff" ); - doc->setSyntaxDefinition( SyntaxDefinitionManager::instance()->getByLSPName( "diff" ) ); + ret.second->setSyntaxDefinition( SyntaxDefinitionManager::instance()->getByLSPName( "diff" ) ); doc->textInput( res.result, false ); doc->moveToStartOfDoc(); doc->resetUndoRedo();