From eb5052f1f8ca87f2502ccdfbf84a2e45289ee68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Tue, 20 Jun 2023 22:59:34 -0700 Subject: [PATCH] bootloader: Replace references to original homepath. --- bootloader/src/pyi_main.c | 12 +++++------- bootloader/src/pyi_path.c | 12 ------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/bootloader/src/pyi_main.c b/bootloader/src/pyi_main.c index 76f46d0b3cf..8e0d47e616e 100644 --- a/bootloader/src/pyi_main.c +++ b/bootloader/src/pyi_main.c @@ -84,7 +84,6 @@ pyi_main(int argc, char * argv[]) ARCHIVE_STATUS *archive_status = NULL; SPLASH_STATUS *splash_status = NULL; char executable[PATH_MAX]; - char homepath[PATH_MAX]; char archivefile[PATH_MAX]; int rc = 0; int in_child = 0; @@ -102,8 +101,7 @@ pyi_main(int argc, char * argv[]) return -1; } if ((! pyi_path_executable(executable, argv[0])) || - (! pyi_path_archivefile(archivefile, executable)) || - (! pyi_path_homepath(homepath, executable))) { + (! pyi_path_archivefile(archivefile, executable))) { return -1; } @@ -196,7 +194,7 @@ pyi_main(int argc, char * argv[]) /* On Windows and Mac use single-process for --onedir mode. */ if (!extractionpath && !pyi_launch_need_to_extract_binaries(archive_status)) { VS("LOADER: No need to extract files to run; setting extractionpath to homepath\n"); - extractionpath = homepath; + extractionpath = archive_status->homepath; } #else @@ -211,7 +209,7 @@ pyi_main(int argc, char * argv[]) /* Set _MEIPASS2, so that the restarted bootloader process will enter * the codepath that corresponds to child process. */ - pyi_setenv("_MEIPASS2", homepath); + pyi_setenv("_MEIPASS2", archive_status->homepath); /* Set _PYI_ONEDIR_MODE to signal to restarted bootloader that it * should reset in_child variable even though it is operating in @@ -296,7 +294,7 @@ pyi_main(int argc, char * argv[]) /* If binaries were extracted to temppath, * we pass it through status variable */ - if (strcmp(homepath, extractionpath) != 0) { + if (strcmp(archive_status->homepath, extractionpath) != 0) { if (snprintf(archive_status->temppath, PATH_MAX, "%s", extractionpath) >= PATH_MAX) { VS("LOADER: temppath exceeds PATH_MAX\n"); @@ -372,7 +370,7 @@ pyi_main(int argc, char * argv[]) VS("LOADER: Executing self as child\n"); pyi_setenv("_MEIPASS2", archive_status->temppath[0] != - 0 ? archive_status->temppath : homepath); + 0 ? archive_status->temppath : archive_status->homepath); VS("LOADER: set _MEIPASS2 to %s\n", pyi_getenv("_MEIPASS2")); diff --git a/bootloader/src/pyi_path.c b/bootloader/src/pyi_path.c index b61f57ed6b1..2f7cca7c817 100644 --- a/bootloader/src/pyi_path.c +++ b/bootloader/src/pyi_path.c @@ -411,18 +411,6 @@ pyi_path_executable(char *execfile, const char *appname) return true; } -/* - * Return absolute path to homepath. It is the directory containing executable. - */ -bool -pyi_path_homepath(char *homepath, const char *thisfile) -{ - /* Fill in here (directory of thisfile). */ - bool rc = pyi_path_dirname(homepath, thisfile); - VS("LOADER: homepath is %s\n", homepath); - return rc; -} - /* * Return full path to an external PYZ-archive. * The name is based on the excutable's name: path/myappname.pkg