FIX:Plugin first fails to install Mac

jira: STUDIO-11242
Change-Id: I9c3484e18c3da75a5dee62523e32ac6ad6c9b207
(cherry picked from commit d5d4dc46386894b636c189da15978df11f8393c0)
This commit is contained in:
zhou.xu
2025-04-01 11:17:23 +08:00
committed by Noisyfox
parent 3ef47c0a38
commit 8b2d727edd
3 changed files with 66 additions and 23 deletions

View File

@@ -910,6 +910,34 @@ __finished:
#endif
}
bool copy_framework(const std::string &from, const std::string &to)
{
boost::filesystem::path src(from), dst(to);
try {
if (!boost::filesystem::is_directory(src)) {
std::cerr << "Error: Source is not a directory: " << src << std::endl;
return false;
}
boost::filesystem::create_directories(dst);
for (boost::filesystem::directory_iterator it(src); it != boost::filesystem::directory_iterator(); ++it) {
const auto &entry = it->path();
const auto dest_path = dst / entry.filename();
if (boost::filesystem::is_symlink(entry)) {
boost::filesystem::copy_symlink(entry, dest_path);
} else if (boost::filesystem::is_directory(entry)) {
copy_framework(it->path().string(), dest_path.string());
} else {
boost::filesystem::copy(entry, dest_path, boost::filesystem::copy_options::overwrite_existing);
}
}
return true;
} catch (const boost::filesystem::filesystem_error &e) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Filesystem error: " << e.what();
}
return false;
}
CopyFileResult check_copy(const std::string &origin, const std::string &copy)
{
boost::nowide::ifstream f1(origin, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);