I would recommend to use the application support folder (which is inside the library folder) rather than the library folder itself. Instead of hardcoding the location, I additionally recommend to use the FSFindFolder function of the Carbon framework.
FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, theRef);
A platform independent implementation could be:
function AppDataFolder: String;
{ platform-independend method to search for the location of application data folder}
const
kMaxPath = 1024;
var
{$IFDEF DARWIN}
theError: OSErr;
theRef: FSRef;
{$ENDIF}
pathBuffer: PChar;
begin
{$IFDEF DARWIN}
try
pathBuffer := Allocmem(kMaxPath);
except on exception do exit;
end;
try
Fillchar(pathBuffer^, kMaxPath, #0);
Fillchar(theRef, Sizeof(theRef), #0);
theError := FSFindFolder(kOnAppropriateDisk, kApplicationSupportFolderType, kCreateFolder, theRef);
if (pathBuffer <> nil) and (theError = noErr) then
begin
theError := FSRefMakePath(theRef, pathBuffer, kMaxPath);
if theError = noErr then AppDataFolder := UTF8ToAnsi(StrPas(pathBuffer)) + '/';
end;
finally
Freemem(pathBuffer);
end
{$ELSE}
AppDataFolder := GetUserDir;
{$ENDIF}
end;
For sake of completeness a similar algorithm finds the correct preferences folder:
function GetPreferencesFolder: String;
{ platform-independend method to search for the location of preferences folder}
const
kMaxPath = 1024;
var
{$IFDEF DARWIN}
theError: OSErr;
theRef: FSRef;
{$ENDIF}
pathBuffer: PChar;
begin
{$IFDEF DARWIN}
try
pathBuffer := Allocmem(kMaxPath);
except on exception do exit;
end;
try
Fillchar(pathBuffer^, kMaxPath, #0);
Fillchar(theRef, Sizeof(theRef), #0);
theError := FSFindFolder(kOnAppropriateDisk, kPreferencesFolderType, kDontCreateFolder, theRef);
if (pathBuffer <> nil) and (theError = noErr) then
begin
theError := FSRefMakePath(theRef, pathBuffer, kMaxPath);
if theError = noErr then GetPreferencesFolder := UTF8ToAnsi(StrPas(pathBuffer)) + '/';
end;
finally
Freemem(pathBuffer);
end
{$ELSE}
GetPreferencesFolder := GetAppConfigDir(false);
{$ENDIF}
end;
function GetPreferencesFile: String;
begin
{$IFDEF LCLCarbon}
GetPreferencesFile := GetPreferencesFolder + SIMTHYR_GLOBAL_ID + '.xml';
{$ELSE}
GetPreferencesFile := GetAppConfigFile(false);
{$ENDIF}
end;