macOS paths

Find quick help here to get you started with Hollywood
Post Reply
Jan
Posts: 29
Joined: Sun Sep 17, 2017 10:28 am
Location: Slovakia
Contact:

macOS paths

Post 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!
plouf
Posts: 680
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: macOS paths

Post 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
Christos
Flinx
Posts: 352
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: macOS paths

Post 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.
Jan
Posts: 29
Joined: Sun Sep 17, 2017 10:28 am
Location: Slovakia
Contact:

Re: macOS paths

Post by Jan »

Thank you so much, both! I'll try it out. Cheers!
Post Reply