Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

Revert "feat(windows): add executable path check"

Prediditb561112bcbdc
diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp
index 89142717..1ae7e702 100644
--- a/windows/runner/main.cpp
+++ b/windows/runner/main.cpp
@@ -2,8 +2,6 @@
#include <flutter/flutter_view_controller.h>
#include <windows.h>
-#include <string>
-
#include "flutter_window.h"
#include "utils.h"
@@ -24,63 +22,6 @@ HANDLE mutex = NULL;
// Window class name must match the one in win32_window.cpp
constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
-// Check if a wide string contains non-ASCII characters
-bool ContainsNonAscii(const std::wstring& str) {
- for (wchar_t ch : str) {
- if (ch > 127) {
- return true;
- }
- }
- return false;
-}
-
-// Get the directory where the executable is located
-std::wstring GetExecutableDirectory() {
- wchar_t path[MAX_PATH];
- DWORD length = ::GetModuleFileNameW(NULL, path, MAX_PATH);
- if (length == 0 || length == MAX_PATH) {
- return L"";
- }
- std::wstring fullPath(path);
- size_t lastSlash = fullPath.find_last_of(L"\\/");
- if (lastSlash != std::wstring::npos) {
- return fullPath.substr(0, lastSlash);
- }
- return fullPath;
-}
-
-// Check if the executable path contains non-ASCII characters and show error if so
-bool CheckPathForNonAscii() {
- std::wstring exeDir = GetExecutableDirectory();
- if (exeDir.empty()) {
- return true;
- }
-
- if (ContainsNonAscii(exeDir)) {
- // Build error message with Unicode escape sequences
- // Message in Chinese and English explaining the path issue
- std::wstring message =
- L"Kazumi \u65E0\u6CD5\u5728\u5305\u542B\u975E ASCII \u5B57\u7B26"
- L"\uFF08\u5982\u4E2D\u6587\u3001\u65E5\u6587\u7B49\uFF09"
- L"\u7684\u8DEF\u5F84\u4E2D\u8FD0\u884C\u3002\n\n"
- L"\u5F53\u524D\u8DEF\u5F84\uFF1A\n" + exeDir + L"\n\n"
- L"\u8BF7\u5C06\u7A0B\u5E8F\u79FB\u52A8\u5230\u4EC5\u5305\u542B"
- L"\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u5E38\u89C1"
- L"\u7B26\u53F7\u7684\u76EE\u5F55\u4E2D\uFF0C\u4F8B\u5982\uFF1A\n"
- L"C:\\Program Files\\Kazumi\n\n"
- L"Kazumi cannot run in a path containing non-ASCII characters.\n"
- L"Please move the program to a directory with only ASCII characters.";
- ::MessageBoxW(
- NULL,
- message.c_str(),
- L"\u8DEF\u5F84\u9519\u8BEF / Path Error",
- MB_OK | MB_ICONERROR
- );
- return false;
- }
- return true;
-}
-
bool ActivateExistingWindow()
{
// Find the existing window by class name
@@ -136,13 +77,6 @@ bool isSingleInstance()
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command)
{
- // Check if the executable path contains non-ASCII characters
- // Flutter engine will silently crash if the path contains non-ASCII characters
- if (!CheckPathForNonAscii())
- {
- return EXIT_FAILURE;
- }
-
// Make sure the application is a single instance.
// This is important for the application to work correctly with the local storage.
if (!isSingleInstance())