From ea7f999d75c1d13271fe502f114d923ae02bfd84 Mon Sep 17 00:00:00 2001 From: j-bryan Date: Tue, 20 Aug 2024 15:09:45 -0600 Subject: [PATCH] fixes for mac build --- package/force_launcher.scpt | 25 +++++++++++++++---------- package/setup.py | 3 ++- package/ui/utils.py | 12 ++++++------ 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/package/force_launcher.scpt b/package/force_launcher.scpt index c819b636..c5fe7d36 100644 --- a/package/force_launcher.scpt +++ b/package/force_launcher.scpt @@ -1,23 +1,28 @@ set options to {"HERON", "RAVEN", "TEAL", "Quit"} -set resourceName to "heron" -set filePathName to quoted form of POSIX path of (path to resource resourceName) as text - -set selectedOption to choose from list options with title "FORCE Launcher" with prompt "Which FORCE application woudl you like to use?" default items {"HERON"} +set selectedOption to choose from list options with title "FORCE Launcher" with prompt "Which FORCE application would you like to use?" default items {"HERON"} if selectedOption is false then display dialog "No option selected. Exiting..." buttons {"OK"} default button "OK" else set selectedOption to item 1 of selectedOption if selectedOption is "HERON" then - set resourceName to "heron" + set filePathName to quoted form of "/Applications/FORCE.app/Contents/Resources/heron" else if selectedOption is "RAVEN" then - set resourceName to "raven_framework" + set filePathName to quoted form of "/Applications/FORCE.app/Contents/Resources/raven_framework" else if selectedOption is "TEAL" then - set resourceName to "teal" + set filePathName to quoted form of "/Applications/FORCE.app/Contents/Resources/teal" else if selectedOption is "Quit" then display dialog "Exiting..." buttons {"OK"} default button "OK" + return end if - set filePathName to quoted form of POSIX path of (path to resource resourceName) as text - do shell script filePathName -end if + -- do shell script filePathName + try + do shell script "test -e " & filePathName + -- If the test passes, the file exists and we proceed with the script + do shell script filePathName + on error + -- If the file doesn't exist, display an error message + display dialog "The file at " & filePathName & " does not exist." buttons {"OK"} default button "OK" + end try +end if \ No newline at end of file diff --git a/package/setup.py b/package/setup.py index 5932543b..ba111e93 100644 --- a/package/setup.py +++ b/package/setup.py @@ -33,7 +33,8 @@ else: ipopt_path = os.path.join(os.path.dirname(sys.executable), "ipopt") build_exe_options["include_files"] += [ - (ipopt_path, "local/bin/ipopt") + # (ipopt_path, "local/bin/ipopt") + (ipopt_path, "ipopt") # put it in main directory ] setup( diff --git a/package/ui/utils.py b/package/ui/utils.py index e1b3b0e6..67830bcb 100644 --- a/package/ui/utils.py +++ b/package/ui/utils.py @@ -52,10 +52,9 @@ def get_workbench_dir_from_exe_path(workbench_exe_path: pathlib.Path) -> pathlib @ In, workbench_exe_path, pathlib.Path, the path to the Workbench executable @ Out, workbench_dir, pathlib.Path, the path to the Workbench installation directory """ - if platform.system() == "Darwin": - workbench_dir = workbench_exe_path.parent.parent.parent - else: - workbench_dir = workbench_exe_path.parent.parent + # NOTE: for macOS, this returns the path to the "Contents" directory in the app bundle, not the + # app bundle's root directory. However, this keeps pathing more consistent with other platforms. + workbench_dir = workbench_exe_path.parent.parent return workbench_dir @@ -251,7 +250,7 @@ def create_workbench_heron_default(workbench_dir: pathlib.Path): " default {\n" " options {\n" " shared {\n" - f" \"Executable\"=\"{heron_path}\"\n" + f" Executable=\"{heron_path}\"\n" " }\n" " }\n" " }\n" @@ -271,7 +270,8 @@ def convert_xml_to_heron(xml_file: pathlib.Path, workbench_path: pathlib.Path) - # Find the xml2eddi.py script in the Workbench installation directory xml2eddi_script = workbench_path / "rte" / "util" / "xml2eddi.py" if not xml2eddi_script.exists(): - print("ERROR: Could not find the xml2eddi.py script in the Workbench installation directory.") + print(f"ERROR: Could not find the xml2eddi.py script in the Workbench installation directory ({str(workbench_path)}). " + f"Checked {str(xml2eddi_script)}.") return None # Convert the .xml file to a .heron file by running the xml2eddi.py script with the .xml file as