diff --git a/include/eepp/system/filesystem.hpp b/include/eepp/system/filesystem.hpp index 495c6ef3e..9fdfee4d7 100644 --- a/include/eepp/system/filesystem.hpp +++ b/include/eepp/system/filesystem.hpp @@ -79,6 +79,9 @@ class EE_API FileSystem { /** Deletes a file from the file system. */ static bool fileRemove( const std::string& filepath ); + /** Hides the file in the file system */ + static bool fileHide( const std::string& filepath ); + /** @return The modification date of the file */ static Uint32 fileGetModificationDate( const std::string& filepath ); diff --git a/premake4.lua b/premake4.lua index f4902a2d3..1d6933ec2 100644 --- a/premake4.lua +++ b/premake4.lua @@ -229,7 +229,7 @@ function get_dll_extension() end function get_host() - if os.getenv("MSYSTEM") ~= "" then + if os.getenv("MSYSTEM") ~= "" and not is_vs() then return "msys" end return os.get() diff --git a/premake5.lua b/premake5.lua index df954fb49..1cc4402c5 100644 --- a/premake5.lua +++ b/premake5.lua @@ -32,7 +32,7 @@ function get_dll_extension() end function get_host() - if os.getenv("MSYSTEM") ~= "" then + if os.getenv("MSYSTEM") ~= "" and not is_vs() then return "msys" end return os.host() diff --git a/src/eepp/system/filesystem.cpp b/src/eepp/system/filesystem.cpp index fbbf89d2d..9e70676dd 100644 --- a/src/eepp/system/filesystem.cpp +++ b/src/eepp/system/filesystem.cpp @@ -203,6 +203,17 @@ bool FileSystem::fileRemove( const std::string& filepath ) { #endif } +bool FileSystem::fileHide( const std::string& filepath ) { +#if EE_PLATFORM == EE_PLATFORM_WIN + return SetFileAttributesW( (LPCWSTR)String( filepath ).toWideString().c_str(), + FILE_ATTRIBUTE_HIDDEN ); +#elif EE_PLATFORM == EE_PLATFORM_MACOS + return 0 == chflags( filename.c_str(), UF_HIDDEN ); +#else + return false; +#endif +} + Uint32 FileSystem::fileGetModificationDate( const std::string& filepath ) { struct stat st; int res = stat( filepath.c_str(), &st ); diff --git a/src/tools/ecode/plugins/formatter/formatterplugin.cpp b/src/tools/ecode/plugins/formatter/formatterplugin.cpp index 2e37f8abd..f72d29d11 100644 --- a/src/tools/ecode/plugins/formatter/formatterplugin.cpp +++ b/src/tools/ecode/plugins/formatter/formatterplugin.cpp @@ -372,6 +372,7 @@ void FormatterPlugin::formatDoc( UICodeEditor* editor ) { doc->save( fileString, true ); FileSystem::fileWrite( tmpPath, (Uint8*)fileString.getStreamPointer(), fileString.getSize() ); + FileSystem::fileHide( tmpPath ); runFormatter( editor, formatter, tmpPath ); if ( formatter.type == FormatterType::Inplace ) { diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index d84364333..bad0ad81f 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -776,6 +776,7 @@ void LinterPlugin::lintDoc( std::shared_ptr doc ) { doc->save( fileString, true ); FileSystem::fileWrite( tmpPath, (Uint8*)fileString.getStreamPointer(), fileString.getSize() ); + FileSystem::fileHide( tmpPath ); runLinter( doc, linter, tmpPath ); FileSystem::fileRemove( tmpPath ); } else { diff --git a/src/tools/uieditor/uieditor.cpp b/src/tools/uieditor/uieditor.cpp index 768e74580..c5def392b 100644 --- a/src/tools/uieditor/uieditor.cpp +++ b/src/tools/uieditor/uieditor.cpp @@ -329,6 +329,7 @@ void App::saveTmpDocument( TextDocument& doc, IOStreamString fileString; doc.save( fileString, true ); FileSystem::fileWrite( tmpPath, (Uint8*)fileString.getStreamPointer(), fileString.getSize() ); + FileSystem::fileHide( tmpPath ); action( tmpPath ); FileSystem::fileRemove( tmpPath ); }