Add OSX_GetBundlePath() to libosxutil

Originally committed to SVN as r2642.
This commit is contained in:
Niels Martin Hansen 2009-01-04 11:09:53 +00:00
parent c29a1c71f9
commit 00d15ee4db
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2008 Niels Martin Hansen Copyright (c) 2008-2009 Niels Martin Hansen
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
@ -60,6 +60,11 @@ static char * GetDir(GetURLFunc GetURL)
return strdup(res_dir_str); return strdup(res_dir_str);
} }
char * OSX_GetBundlePath()
{
return GetDir(CFBundleCopyBundleURL);
}
char * OSX_GetBundleResourcesDirectory() char * OSX_GetBundleResourcesDirectory()
{ {
return GetDir(CFBundleCopyResourcesDirectoryURL); return GetDir(CFBundleCopyResourcesDirectoryURL);

View file

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2008 Niels Martin Hansen Copyright (c) 2008-2009 Niels Martin Hansen
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
@ -45,6 +45,10 @@
All of the functions may return NULL on error. All of the functions may return NULL on error.
*/ */
/* Get the full name of the bundle itself. May return NULL if the current
executable is not inside a bundle. */
char * OSX_GetBundlePath();
/* Get the resources directory, mainly for user interface elements /* Get the resources directory, mainly for user interface elements
such as graphics and strings */ such as graphics and strings */
char * OSX_GetBundleResourcesDirectory(); char * OSX_GetBundleResourcesDirectory();