Mac Issues (Shared Location etc)

BlitzMax Forums/BlitzMax Programming/Mac Issues (Shared Location etc)

therevills(Posted 2012) [#1]
Hey guys

BFG are getting picky with their Mac releases, here are a few things they found with my latest game:

* CMD + Q does not function in Full Screen
* Force Quitting in full screen may result in an ini error message on relaunch
* Title bar lists version number
* Game does not save to recommended location

And whats funny is that all my previous games has these "issues"...

So I've added CMD+Q:


		 ?MacOS
		 If KeyDown(KEY_Q) And (KeyDown(KEY_LSYS) Or KeyDown(KEY_RSYS)) Then
			 TerminatedEvent = 1
		 EndIf
		 ?


Removed the ini message (its part of GAF)...

I've left the version number in the title bar... its there for a reason! (so we can tell what version the player is using if bugs pop up later on...)

Now to the problem one: Game does not save to recommended location

Since I use GAF it is saving data to the: /Users/Shared/The Revills Games/Game Name location
and they want it saved to the: ~/Library/Preferences or ~/Library/Application Support Location

Looking thru the code, it looks like GAF uses this:

?MacOS
Extern
	 Function FSFindFolder:Int( vRefNum:Int ,folderType:Int ,createFolder:Int ,foundRef:Byte Ptr )
	 Function FSRefMakePath:Int( ref:Byte Ptr,path:Byte Ptr, maxPath:Int )
End Extern
?


I've got no idea on how to change this to use the locations they want me to use... any tips?


therevills(Posted 2012) [#2]
Okay looking at Brucey's great code in the Volumes mod, he has got the following:

	Method GetUserAppDir:String()
		Return getPath(kApplicationSupportFolderType)
	End Method


Which calls:

	Method getPath:String(folderType:Int, flags:Int = 0)
		Local buf:Byte[1024],ref:Byte[80]
		
		If flags Then
			If FSFindFolder( flags, folderType, False, ref ) Return Null
		Else
			If FSFindFolder( kUserDomain, folderType, False, ref ) Return Null
		End If
		If FSRefMakePath( ref,buf,1024 ) Return Null
		
		Return bbStringFromUTF8String( buf )
	End Method


and kApplicationSupportFolderType is defined as:

Const kApplicationSupportFolderType:Int = Asc("a") Shl 24 | Asc("s") Shl 16 | Asc( "u") Shl 8 | Asc("p")


And from Brucey's notes:

GetUserAppDir - Mac OS /Users/username/Library/Application Support ~/Library/Application Support

So hopefully this works :)