Page 1 of 1

macOS paths

Posted: Mon Jan 26, 2026 5:23 am
by Jan
HI, when I run my script from the Hollywood GUI/Interpreter, DownloadFile() saves files in the same directory as the .hws script.

But when I compile the script as a standalone macOS app (ARM64), the files are saved inside the App Bundle at MyApp.app/Contents/Resources/

How can I make it save next to the .app file instead? I am looking for a solution that can be implemented in the main script so that it remains compatible with other platforms (avoiding a macOS-only version).

Thanks!

Re: macOS paths

Posted: Mon Jan 26, 2026 6:11 am
by plouf
Dont know about macos pecularities but

Basically stringWithFile$=DownloadFile() download file in the string, and then you save the stringWithFile$ wherever you want!

On top of that ,if there is a diffirent behavioir under some circumentances , like as you said between compiled/script
You can use preprocessor @IF to keep diffirence i.e

Code: Select all

@IF #final_app=true
 ; do some stuff
 @ELSE 
 ; do it diffient
 @ENDIF

Re: macOS paths

Posted: Tue Jan 27, 2026 5:57 pm
by Flinx
To make things different for the application type:

Code: Select all

	Local prgtype, prgname$, hw$ = GetProgramInfo()
	Switch prgtype
	Case #PRGTYPE_SCRIPT:
		...
	Case #PRGTYPE_APPLET:
		...
	Case #PRGTYPE_PROGRAM:
And to get the paths you can use GetSystemInfo():

Code: Select all

Local GVtbl=GetVersion()
If GVtbl.platform="MacOS"
	Local si=GetSystemInfo()
Now you have si.AppData and si.AppBundle or you could use relative paths like "../../.." to get out of the appBundle.

Re: macOS paths

Posted: Tue Jan 27, 2026 6:13 pm
by Jan
Thank you so much, both! I'll try it out. Cheers!