Skip to content

Commit

Permalink
fix: correct mappingFile behavior
Browse files Browse the repository at this point in the history
Signed-off-by: ComixHe <heyuming@deepin.org>
  • Loading branch information
ComixHe committed Dec 19, 2024
1 parent bb25607 commit 1fc0155
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libs/linglong/src/linglong/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,19 +1790,17 @@ int Cli::content()
std::error_code ec;
if (!std::filesystem::is_symlink(file, ec)) {
if (ec) {
qWarning() << "failed to check symlink " << file.c_str() << ":" << ec.message().c_str()
<< ", passing the file path to app as it is.";
qWarning() << "failed to check symlink " << file.c_str() << ":" << ec.message().c_str();
}

return file;
return std::filesystem::path{ "/run/host/rootfs" } / file.lexically_relative("/");
}

std::array<char, PATH_MAX + 1> buf{};
auto *target = ::realpath(file.c_str(), buf.data());
if (target == nullptr) {
qWarning() << "resolve symlink " << file.c_str() << " error: " << ::strerror(errno)
<< ", passing the file path to app as it is.";
return file;
qWarning() << "resolve symlink " << file.c_str() << " error: " << ::strerror(errno);
return std::filesystem::path{ "/run/host/rootfs" } / file.lexically_relative("/");
}

return std::filesystem::path{ "/run/host/rootfs" }
Expand Down

0 comments on commit 1fc0155

Please sign in to comment.