More AppImage Fixes

This commit is contained in:
TheBrokenRail 2022-04-20 18:21:29 -04:00
parent 4edfaeead4
commit 89c29f14b1

View File

@ -152,8 +152,6 @@ void pre_bootstrap() {
if (owd != NULL && chdir(owd) != 0) { if (owd != NULL && chdir(owd) != 0) {
ERR("AppImage: Unable To Fix Current Directory: %s", strerror(errno)); ERR("AppImage: Unable To Fix Current Directory: %s", strerror(errno));
} }
// AppImageCrafters/AppRun#53
set_and_print_env("APPDIR_FORCE_BUNDLE_RUNTIME", "1");
#endif #endif
// Get Binary Directory // Get Binary Directory
@ -243,6 +241,12 @@ void bootstrap(int argc, char *argv[]) {
} }
} }
// AppImage
#ifdef MCPI_IS_APPIMAGE_BUILD
// Mark Patched MCPI As Part Of AppImage
set_and_print_env("APPDIR_MODULE_DIR", getenv("MCPI_EXECUTABLE_PATH"));
#endif
// Configure LD_LIBRARY_PATH // Configure LD_LIBRARY_PATH
{ {
// Log // Log
@ -280,12 +284,15 @@ void bootstrap(int argc, char *argv[]) {
PRESERVE_ENVIRONMENTAL_VARIABLE("LD_PRELOAD"); PRESERVE_ENVIRONMENTAL_VARIABLE("LD_PRELOAD");
char *new_ld_preload = NULL; char *new_ld_preload = NULL;
// Add LD_PRELOAD // Built-In Mods
{ {
char *value = get_env_safe("LD_PRELOAD"); // Get Mods Folder
if (strlen(value) > 0) { char *mods_folder = NULL;
string_append(&new_ld_preload, ":%s", value); safe_asprintf(&mods_folder, "%s/mods/", binary_directory);
} // Load Mods From ./mods
load(&new_ld_preload, mods_folder);
// Free Mods Folder
free(mods_folder);
} }
// ~/.minecraft-pi/mods // ~/.minecraft-pi/mods
@ -299,15 +306,12 @@ void bootstrap(int argc, char *argv[]) {
free(mods_folder); free(mods_folder);
} }
// Built-In Mods // Add LD_PRELOAD
{ {
// Get Mods Folder char *value = get_env_safe("LD_PRELOAD");
char *mods_folder = NULL; if (strlen(value) > 0) {
safe_asprintf(&mods_folder, "%s/mods/", binary_directory); string_append(&new_ld_preload, ":%s", value);
// Load Mods From ./mods }
load(&new_ld_preload, mods_folder);
// Free Mods Folder
free(mods_folder);
} }
// Set LD_PRELOAD // Set LD_PRELOAD