Skip to content

Commit

Permalink
fix: 尝试修复linux上的fs崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jun 14, 2024
1 parent f00ea1c commit 77c6514
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions source/MaaAdbControlUnit/Base/ProcessArgvGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,23 @@ std::optional<ProcessArgvGenerator::ProcessArgv>
}

auto stdpath = MAA_NS::path(res.front());
auto searched_path = boost::process::search_path(stdpath);
std::filesystem::path abs_path;
if (stdpath.is_absolute()) {
abs_path = stdpath;
}
else {
abs_path = boost::process::search_path(stdpath);
}

if (!std::filesystem::exists(searched_path)) {
LogError << "exec path not exists" << VAR(searched_path);
if (!std::filesystem::exists(abs_path)) {
LogError << "exec path not exists" << VAR(abs_path);
return std::nullopt;
}

auto args =
std::vector(std::make_move_iterator(res.begin() + 1), std::make_move_iterator(res.end()));

return ProcessArgv { .exec = std::move(searched_path), .args = std::move(args) };
return ProcessArgv { .exec = std::move(abs_path), .args = std::move(args) };
}

MAA_CTRL_UNIT_NS_END
MAA_CTRL_UNIT_NS_END
4 changes: 2 additions & 2 deletions source/MaaToolkit/AdbDevice/DeviceMgrWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ DeviceMgrWin32::DeviceMgrWin32()
.adb_common_serials = { "127.0.0.1:21503" } } },

{ "AVD",
{ .keyword = "qemu",
{ .keyword = "qemu-system",
.adb_candidate_paths = { "..\\..\\..\\platform-tools\\adb.exe"_path },
.adb_common_serials = { "127.0.0.1:5555" } } },
.adb_common_serials = { "emulator-5554", "127.0.0.1:5555" } } },
};

set_emulator_const_data(std::move(emulators));
Expand Down

0 comments on commit 77c6514

Please sign in to comment.