Add Windows compatibility for GUI test command in CLI
- Updated `HandleTestGuiCommand` in `ModernCLI` to return an error message on Windows, indicating that the GUI test command is unsupported. - Wrapped platform-specific includes and logic with preprocessor directives to ensure compatibility across different operating systems. - Enhanced code maintainability by clearly separating Windows-specific functionality from other platforms.
This commit is contained in:
@@ -9,8 +9,10 @@
|
|||||||
#include "absl/flags/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/flags/parse.h"
|
#include "absl/flags/parse.h"
|
||||||
#include "absl/flags/usage.h"
|
#include "absl/flags/usage.h"
|
||||||
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#endif
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -436,6 +438,11 @@ class ModernCLI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status HandleTestGuiCommand(const std::vector<std::string>& args) {
|
absl::Status HandleTestGuiCommand(const std::vector<std::string>& args) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
return absl::UnimplementedError(
|
||||||
|
"GUI test command is not supported on Windows. "
|
||||||
|
"Please run yaze_test.exe directly with --enable-ui-tests flag.");
|
||||||
|
#else
|
||||||
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
std::string rom_file = absl::GetFlag(FLAGS_rom);
|
||||||
std::string test_name = absl::GetFlag(FLAGS_test);
|
std::string test_name = absl::GetFlag(FLAGS_test);
|
||||||
|
|
||||||
@@ -505,6 +512,7 @@ class ModernCLI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status HandleHelpCommand(const std::vector<std::string>& args) {
|
absl::Status HandleHelpCommand(const std::vector<std::string>& args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user