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}")
if(NOT MCPI_SERVER_MODE)
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()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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