Fix More AppImage Bugs

This commit is contained in:
TheBrokenRail 2022-03-09 23:29:37 -05:00
parent 244a69d1aa
commit 53b2c20b8b
7 changed files with 29 additions and 7 deletions

View File

@ -14,5 +14,12 @@ if(BUILD_NATIVE_COMPONENTS)
install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_VARIANT_NAME}") install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_VARIANT_NAME}")
if(NOT MCPI_SERVER_MODE) if(NOT MCPI_SERVER_MODE)
install(DIRECTORY "client-data/" DESTINATION ".") install(DIRECTORY "client-data/" DESTINATION ".")
else()
set(ICON_PATH "share/icons/hicolor/scalable/apps")
install(
FILES "client-data/${ICON_PATH}/com.thebrokenrail.MCPIReborn.png"
DESTINATION "${ICON_PATH}"
RENAME "com.thebrokenrail.MCPIRebornServer.png"
)
endif() endif()
endif() endif()

View File

@ -139,16 +139,20 @@ static void load(char **ld_preload, char *folder) {
#define MCPI_BINARY "minecraft-pi" #define MCPI_BINARY "minecraft-pi"
#define QEMU_BINARY "qemu-arm" #define QEMU_BINARY "qemu-arm"
// Bootstrap // Pre-Bootstrap
void bootstrap(int argc, char *argv[]) { void pre_bootstrap() {
INFO("%s", "Configuring Game...");
// AppImage // AppImage
#ifdef MCPI_IS_APPIMAGE_BUILD #ifdef MCPI_IS_APPIMAGE_BUILD
if (chdir(getenv("OWD")) != 0) { char *owd = getenv("OWD");
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));
} }
#endif #endif
}
// Bootstrap
void bootstrap(int argc, char *argv[]) {
INFO("%s", "Configuring Game...");
// Get Binary Directory // Get Binary Directory
char *binary_directory = get_binary_directory(); char *binary_directory = get_binary_directory();
@ -156,6 +160,9 @@ void bootstrap(int argc, char *argv[]) {
// Handle AppImage // Handle AppImage
#ifdef MCPI_IS_APPIMAGE_BUILD #ifdef MCPI_IS_APPIMAGE_BUILD
char *usr_prefix = getenv("APPDIR"); char *usr_prefix = getenv("APPDIR");
if (usr_prefix == NULL) {
usr_prefix = "";
}
#else #else
char *usr_prefix = ""; char *usr_prefix = "";
#endif #endif

View File

@ -6,6 +6,7 @@ extern "C" {
void set_and_print_env(const char *name, char *value); void set_and_print_env(const char *name, char *value);
void pre_bootstrap();
void bootstrap(int argc, char *argv[]); void bootstrap(int argc, char *argv[]);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -121,6 +121,9 @@ static void run_zenity_and_set_env(const char *env_name, std::vector<std::string
// Launch // Launch
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
// Pre-Bootstrap
pre_bootstrap();
// Print Features // Print Features
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--print-available-feature-flags") == 0) { if (strcmp(argv[i], "--print-available-feature-flags") == 0) {

View File

@ -4,6 +4,9 @@
#include "../bootstrap.h" #include "../bootstrap.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
// Pre-Bootstrap
pre_bootstrap();
// Set Home To Current Directory, So World Data Is Stored There // Set Home To Current Directory, So World Data Is Stored There
char *launch_directory = getcwd(NULL, 0); char *launch_directory = getcwd(NULL, 0);
set_and_print_env("HOME", launch_directory); set_and_print_env("HOME", launch_directory);

View File

@ -138,7 +138,7 @@ const appDir = {
app_info: { app_info: {
id: id, id: id,
name: `${name}`, name: `${name}`,
icon: mode === 'client' ? id : 'utilities-terminal', icon: id,
version: version, version: version,
exec: `usr/bin/${name}`, exec: `usr/bin/${name}`,
exec_args: '$@' exec_args: '$@'

View File

@ -74,7 +74,7 @@ if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then
libxext-dev:armhf libxext-dev:arm64 libxext-dev:armhf libxext-dev:arm64
fi fi
# Install appimagetool Dependencies # Install appimagetool & appimage-builder Dependencies
queue_pkg \ queue_pkg \
python3-pip \ python3-pip \
python3-setuptools \ python3-setuptools \
@ -84,6 +84,7 @@ queue_pkg \
fakeroot \ fakeroot \
strace \ strace \
fuse \ fuse \
gtk-update-icon-cache \
sed sed
# Install Queue # Install Queue