1
0
mirror of synced 2024-11-12 02:00:52 +01:00

Add rpath to binary executable on macOS (#258)

* removing superfluous slash from paths

* Add a necessary rpath to the imhex binary

* add a little error handling to dlopen

* fall back on en-US if no language specified in prefs

* PR changes as per @WerWolv
This commit is contained in:
Foster Brereton 2021-06-18 11:09:36 -07:00 committed by GitHub
parent b4b2c41b34
commit ac53b4bcab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 11 deletions

View File

@ -57,3 +57,7 @@ if (CODE_SIGN_CERTIFICATE_ID)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${BUNDLE_PATH}")
execute_process(COMMAND ${CMAKE_COMMAND} -E rename "${BUNDLE_PATH}.temp" "${BUNDLE_PATH}")
endif()
# Add a necessary rpath to the imhex binary
get_bundle_main_executable("${BUNDLE_PATH}" IMHEX_EXECUTABLE)
execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/../Frameworks/ "${IMHEX_EXECUTABLE}")

View File

@ -19,29 +19,29 @@
NSURL * result = nil;
switch (path) {
case ImHexPath::Patterns:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/patterns"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/patterns"];
break;
case ImHexPath::PatternsInclude:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/patterns"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/patterns"];
break;
case ImHexPath::Magic:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/magic"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/magic"];
break;
case ImHexPath::Python:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex"];
break;
case ImHexPath::Plugins:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/plugins"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/plugins"];
break;
case ImHexPath::Yara:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/yara"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/yara"];
break;
case ImHexPath::Config:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/config"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/config"];
break;
case ImHexPath::Resources:
result = [appSupportDir URLByAppendingPathComponent:@"/imhex/resources"];
result = [appSupportDir URLByAppendingPathComponent:@"imhex/resources"];
break;
}

View File

@ -15,8 +15,10 @@ namespace hex {
Plugin::Plugin(std::string_view path) {
this->m_handle = dlopen(path.data(), RTLD_LAZY);
if (this->m_handle == nullptr)
if (this->m_handle == nullptr) {
hex::log::error("dlopen failed: {}", dlerror());
return;
}
auto pluginName = fs::path(path).stem().string();

View File

@ -100,8 +100,12 @@ namespace hex {
{
auto language = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.language");
if (language.is_string())
if (language.is_string()) {
LangEntry::loadLanguage(static_cast<std::string>(language));
} else {
// If no language is specified, fall back to English.
LangEntry::loadLanguage("en-US");
}
}
{
@ -787,4 +791,4 @@ namespace hex {
ImGui::DestroyContext();
}
}
}