summaryrefslogtreecommitdiff
path: root/view/macho/universaltransform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'view/macho/universaltransform.cpp')
-rw-r--r--view/macho/universaltransform.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/view/macho/universaltransform.cpp b/view/macho/universaltransform.cpp
index 33164215..3309d853 100644
--- a/view/macho/universaltransform.cpp
+++ b/view/macho/universaltransform.cpp
@@ -266,20 +266,19 @@ bool UniversalTransform::DecodeWithContext(Ref<TransformContext> context, const
architectures.push_back(archName);
}
- // TODO: It is surprising that this is UniversalTransform's responsibility.
- if (!BinaryNinja::IsUIEnabled())
+ if (!context->IsInteractive())
{
- // When headless, filter to the preferred architecture if one is configured.
vector<string> archPref = context->GetSettings()->Get<vector<string>>("files.universal.architecturePreference");
if (auto result = find_first_of(archPref.begin(), archPref.end(), architectures.begin(), architectures.end()); result != archPref.end())
{
+ // Filter to preferred architecture to support container auto-open policy
size_t archIndex = find(architectures.begin(), architectures.end(), *result) - architectures.begin();
context->SetAvailableFiles({architectures[archIndex]});
return false;
}
- // Load the first architecture if no preference is found.
- if (archPref.empty() && architectures.size())
+ // Preserve original headless load behavior when no architecturePreference is specified
+ if (!BinaryNinja::IsUIEnabled() && archPref.empty() && architectures.size())
{
context->SetAvailableFiles({architectures[0]});
return false;