How to find Library path

Archives Forums/MacOS X Discussion/How to find Library path

Ravl(Posted 2012) [#1]
I need to save my profiles and settings to:
~/Library/Application Support
or
~Library/Preferences folder (within the user’s home library).

The full path is:
Macintosh HD/Users/Username/Library/ApplicationSupport/StudioName/GameTitle

Or:

Macintosh HD/Users/Username/Library/Preferences/StudioName/GameTitle

How do I retrieve these folders on MacOS from blitzmax?


Ravl(Posted 2012) [#2]
found this topic: http://www.blitzbasic.com/Community/posts.php?topic=42019

and i think it is what i need


GfK(Posted 2012) [#3]
Is the Libary folder still called "Library" on a non-English version of OSX?


GfK(Posted 2012) [#4]
Actually, never mind. Just modified the code coupled with some googling and the code below now returns the user's Library/Application Support folder path:
?macOS
Const kUserDomain=-32763
Const kApplicationSupportFolderType=Asc("a") Shl 24 | Asc("s") Shl 16 | Asc( "u") Shl 8 | Asc("p")

Extern
	Function FSFindFolder( vRefNum,folderType,createFolder,foundRef:Byte Ptr )
	Function FSRefMakePath( ref:Byte Ptr,path:Byte Ptr,maxPathsize )
End Extern

Function OSX_AppSupportDir$()

	Local buf:Byte[1024],ref:Byte[80]
	
	If FSFindFolder( kUserDomain, kApplicationSupportFolderType,False,ref ) Return
	If FSRefMakePath( ref,buf,1024 ) Return
	
	Return String.FromCString( buf )
	
End Function
?