@@ -367,8 +367,8 @@ std::string Generator::generateTestFile() {
367367 " 按下 " s + (options.UseExternalTerminal ? " F6" : " Ctrl + F5" ) + " 编译运行。" };
368368 const std::string compileResultComment{" 按下 " s +
369369 (options.UseExternalTerminal
370- ? " F5 后,您将在下方弹出的终端(Terminal) "
371- : " F6 后,您将在弹出的 " ) +
370+ ? " F6 后,您将在弹出的 "
371+ : " F5 后,您将在下方弹出的终端(Terminal) " ) +
372372 " 窗口中看到这一行字。" };
373373 bool isCpp{options.Language == ConfigOptions::LanguageType::Cpp};
374374 std::string (*c)(const std::string&){nullptr };
@@ -378,7 +378,7 @@ std::string Generator::generateTestFile() {
378378 c = [](const std::string& s) { return " /* " + s + " */" ; };
379379 std::ostringstream oss;
380380 oss << c (" VS Code C/C++ 测试代码 \" Hello World\" " ) << ' \n ' ;
381- oss << c (" 由 VSCodeConfigHelper 生成" ) << ' \n ' ;
381+ oss << c (" 由 VSCodeConfigHelper v " PROJECT_VERSION " 生成" ) << ' \n ' ;
382382 oss << ' \n ' ;
383383 oss << c (" 您可以在当前的文件夹(工作文件夹)下编写代码。" ) << ' \n ' ;
384384 oss << ' \n ' ;
@@ -460,7 +460,6 @@ void Generator::generateShortcut() {
460460
461461void Generator::generate () {
462462 try {
463- fs::path mingwPath (options.MingwPath );
464463 fs::path dotVscode (fs::path (options.WorkspacePath ) / " .vscode" );
465464
466465 ExtensionManager extensions (options.VscodePath );
@@ -475,13 +474,21 @@ void Generator::generate() {
475474 if (options.ShouldInstallL11n ) {
476475 extensions.install (" ms-ceintl.vscode-language-pack-zh-hans" );
477476 }
478-
479- if (options.UseExternalTerminal ) {
480- saveFile (mingwPath / " pause-console.ps1" , Embed::PAUSE_CONSOLE_PS1);
481- addKeybinding (" f6" , " workbench.action.tasks.runTask" , " run and pause" );
482- }
483- if (options.ApplyNonAsciiCheck ) {
484- saveFile (mingwPath / " check-ascii.ps1" , Embed::CHECK_ASCII_PS1);
477+ if constexpr (Native::isWindows) {
478+ fs::path mingwPath (options.MingwPath );
479+ if (options.UseExternalTerminal ) {
480+ saveFile (mingwPath / " pause-console.ps1" , Embed::PAUSE_CONSOLE_PS1);
481+ addKeybinding (" f6" , " workbench.action.tasks.runTask" , " run and pause" );
482+ }
483+ if (options.ApplyNonAsciiCheck ) {
484+ saveFile (mingwPath / " check-ascii.ps1" , Embed::CHECK_ASCII_PS1);
485+ }
486+ if (!options.NoSetEnv ) {
487+ addToPath (mingwPath);
488+ }
489+ } else {
490+ // *nix specified
491+ // TODO
485492 }
486493
487494 if (fs::exists (dotVscode)) {
@@ -492,10 +499,6 @@ void Generator::generate() {
492499 generateTasksJson (dotVscode / " tasks.json" );
493500 generateLaunchJson (dotVscode / " launch.json" );
494501 generatePropertiesJson (dotVscode / " c_cpp_properties.json" );
495-
496- if (!options.NoSetEnv ) {
497- addToPath (mingwPath);
498- }
499502 if (options.GenerateTestFile == ConfigOptions::GenTestType::Auto) {
500503 if (fs::exists (fs::path (options.WorkspacePath ) / " helloworld.cpp" )) {
501504 options.GenerateTestFile = ConfigOptions::GenTestType::Never;
0 commit comments