OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{PluginAuditManager.cpp} Namespace Reference

Functions

boost::filesystem::path canonical_for_comparison (const boost::filesystem::path &path)
bool ends_in_dangling_symlink (const boost::filesystem::path &path)
bool same_path_component (const boost::filesystem::path &lhs, const boost::filesystem::path &rhs)
bool suffix_inside_root (const boost::filesystem::path &canonical_candidate, const boost::filesystem::path &canonical_root, boost::filesystem::path &suffix)
bool show_permission_dialog (const wxString &message, const wxString &title)

Function Documentation

◆ canonical_for_comparison()

boost::filesystem::path Slic3r::anonymous_namespace{PluginAuditManager.cpp}::canonical_for_comparison ( const boost::filesystem::path & path)
375{
376 namespace fs = boost::filesystem;
377
378 boost::system::error_code ec;
379 fs::path canon = fs::weakly_canonical(path, ec);
380 if (ec) {
381 // Fall back to lexically_normal + absolute
382 canon = fs::absolute(path, ec).lexically_normal();
383 if (ec)
384 canon = path;
385 }
386 return canon;
387}
Definition Utils.hpp:97

References canonical_for_comparison().

Referenced by canonical_for_comparison().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ends_in_dangling_symlink()

bool Slic3r::anonymous_namespace{PluginAuditManager.cpp}::ends_in_dangling_symlink ( const boost::filesystem::path & path)
402{
403 namespace fs = boost::filesystem;
404
405 boost::system::error_code ec;
406 const fs::file_status status = fs::symlink_status(path, ec);
407 // symlink_status does not follow the link, so a missing target still reports symlink; a path
408 // that does not exist at all reports an error instead.
409 if (ec || !fs::is_symlink(status))
410 return false;
411
412 // exists() follows the link: false means the target is missing.
413 return !fs::exists(path, ec);
414}

References ends_in_dangling_symlink().

Referenced by ends_in_dangling_symlink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ same_path_component()

bool Slic3r::anonymous_namespace{PluginAuditManager.cpp}::same_path_component ( const boost::filesystem::path & lhs,
const boost::filesystem::path & rhs )
417{
418#ifdef _WIN32
419 return boost::algorithm::iequals(lhs.native(), rhs.native());
420#else
421 return lhs == rhs;
422#endif
423}

References same_path_component().

Referenced by same_path_component(), and suffix_inside_root().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_permission_dialog()

bool Slic3r::anonymous_namespace{PluginAuditManager.cpp}::show_permission_dialog ( const wxString & message,
const wxString & title )
789{
790 wxMessageDialog dialog(nullptr, message, title, wxYES_NO | wxICON_WARNING);
791 return dialog.ShowModal() == wxID_YES;
792}

References show_permission_dialog().

Referenced by show_permission_dialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ suffix_inside_root()

bool Slic3r::anonymous_namespace{PluginAuditManager.cpp}::suffix_inside_root ( const boost::filesystem::path & canonical_candidate,
const boost::filesystem::path & canonical_root,
boost::filesystem::path & suffix )
432{
433 suffix.clear();
434
435 auto cand_it = canonical_candidate.begin();
436 auto cand_end = canonical_candidate.end();
437 auto root_it = canonical_root.begin();
438 auto root_end = canonical_root.end();
439
440 // Consume matching components
441 while (root_it != root_end && cand_it != cand_end && same_path_component(*root_it, *cand_it)) {
442 ++root_it;
443 ++cand_it;
444 }
445
446 // If we didn't consume the entire root, candidate is not inside it.
447 if (root_it != root_end)
448 return false;
449
450 // The remaining path components must not traverse upward.
451 for (auto it = cand_it; it != cand_end; ++it) {
452 if (*it == "..")
453 return false;
454 }
455
456 for (; cand_it != cand_end; ++cand_it)
457 suffix /= *cand_it;
458 return true;
459}
bool same_path_component(const boost::filesystem::path &lhs, const boost::filesystem::path &rhs)
Definition PluginAuditManager.cpp:416

References same_path_component(), and suffix_inside_root().

Referenced by suffix_inside_root().

Here is the call graph for this function:
Here is the caller graph for this function: