Fix ecode --health for Windows.

VS compilation now uses UTF-8 for the source code encoding.
This commit is contained in:
Martín Lucas Golini
2023-04-13 20:35:41 -03:00
parent a9d0715c8c
commit 7bbf00ea97
8 changed files with 46 additions and 4 deletions

View File

@@ -346,6 +346,7 @@ function build_base_configuration( package_name )
if is_vs() then
includedirs { "src/thirdparty/libzip/vs" }
buildoptions { "/utf-8" }
end
set_ios_config()
@@ -389,6 +390,10 @@ function build_base_cpp_configuration( package_name )
buildoptions{ "-fPIC" }
end
if is_vs() then
buildoptions { "/utf-8" }
end
set_ios_config()
set_xcode_config()
build_arch_configuration()
@@ -490,7 +495,7 @@ function build_link_configuration( package_name, use_ee_icon )
if not is_vs() then
buildoptions{ "-std=c++17" }
else
buildoptions{ "/std:c++17" }
buildoptions{ "/std:c++17", "/utf-8" }
end
if package_name ~= "eepp" and package_name ~= "eepp-static" then

View File

@@ -205,6 +205,7 @@ function build_base_configuration( package_name )
filter "action:vs*"
incdirs { "src/thirdparty/libzip/vs" }
buildoptions { "/utf-8" }
filter "system:emscripten"
buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" }
@@ -226,6 +227,9 @@ function build_base_cpp_configuration( package_name )
defines { "EE_STATIC" }
end
filter "action:vs*"
buildoptions { "/utf-8" }
filter "action:not vs*"
buildoptions { "-Wall" }
@@ -310,6 +314,9 @@ function build_link_configuration( package_name, use_ee_icon )
vpaths { ['Resources/*'] = { "ee.rc", "ee.ico" } }
end
filter "action:vs*"
buildoptions { "/utf-8" }
filter "action:not vs*"
buildoptions { "-Wall" }

View File

@@ -177,6 +177,8 @@ class TerminalDisplay : public ITerminalDisplay {
void executeFile( const std::string& cmd );
void executeBinary( const std::string& binaryPath, const std::string& args = "" );
void action( TerminalShortcutAction action );
bool hasTerminated() const;

View File

@@ -105,6 +105,8 @@ class UITerminal : public UIWidget {
void executeFile( const std::string& cmd );
void executeBinary( const std::string& binaryPath, const std::string& args = "" );
const TerminalColorScheme& getColorScheme() const;
void setColorScheme( const TerminalColorScheme& colorScheme );

View File

@@ -646,6 +646,17 @@ void TerminalDisplay::executeFile( const std::string& cmd ) {
}
}
void TerminalDisplay::executeBinary( const std::string& binaryPath, const std::string& args ) {
if ( mTerminal ) {
std::string rcmd( "\"" + binaryPath + "\"" + " " + args + "\r" );
#if EE_PLATFORM != EE_PLATFORM_WIN
char clearLine = 0x15;
mTerminal->ttywrite( &clearLine, 1, 1 );
#endif
mTerminal->ttywrite( rcmd.c_str(), rcmd.size(), 1 );
}
}
void TerminalDisplay::action( TerminalShortcutAction action ) {
switch ( action ) {
case TerminalShortcutAction::PASTE: {

View File

@@ -244,6 +244,11 @@ void UITerminal::executeFile( const std::string& cmd ) {
mTerm->executeFile( cmd );
}
void UITerminal::executeBinary( const std::string& binaryPath, const std::string& args ) {
if ( mTerm )
mTerm->executeBinary( binaryPath, args );
}
const TerminalColorScheme& UITerminal::getColorScheme() const {
return mTerm->getColorScheme();
}

View File

@@ -2834,10 +2834,14 @@ static std::string getCurrentProcessPath() {
void App::checkLanguagesHealth() {
auto path( getCurrentProcessPath() );
path += " --health";
#if EE_PLATFORM == EE_PLATFORM_WIN
UITerminal* term = mTerminalManager->createNewTerminal(
"", nullptr, "", Sys::getPlatform() == "Windows" ? "cmd.exe" : "" );
#else
UITerminal* term = mTerminalManager->createNewTerminal();
#endif
term->setFocus();
term->executeFile( path );
term->executeBinary( path, "--health" );
}
void App::cleanUpRecentFolders() {

View File

@@ -130,6 +130,12 @@ std::string FeaturesHealth::generateHealthStatus( PluginManager* pluginManager,
.font_style( { FontStyle::bold } );
}
#if EE_PLATFORM == EE_PLATFORM_WIN
std::string check = "Yes";
#else
std::string check = "";
#endif
for ( const auto& ht : status ) {
std::string lspName = ht.lsp.name.empty() ? "None" : ht.lsp.name;
if ( OutputFormat::Markdown == format && !ht.lsp.name.empty() && !ht.lsp.url.empty() ) {
@@ -146,7 +152,7 @@ std::string FeaturesHealth::generateHealthStatus( PluginManager* pluginManager,
formatterName = "[" + ht.formatter.name + "](" + ht.formatter.url + ")";
}
table.add_row( { ht.lang, "", lspName, linterName, formatterName } );
table.add_row( { ht.lang, check, lspName, linterName, formatterName } );
auto& row = table[table.size() - 1];