Codechange: Store file search paths as std::string.

This commit is contained in:
Michael Lutz
2020-12-06 21:11:43 +01:00
parent dd138fc460
commit 0c6e8a8123
7 changed files with 89 additions and 69 deletions

View File

@@ -34,6 +34,7 @@
#include "../../window_func.h"
#include "../../window_gui.h"
#include <array>
#import <sys/param.h> /* for MAXPATHLEN */
/**
@@ -545,13 +546,15 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
*/
void cocoaSetApplicationBundleDir()
{
extern std::array<std::string, NUM_SEARCHPATHS> _searchpaths;
char tmp[MAXPATHLEN];
CFAutoRelease<CFURLRef> url(CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()));
if (CFURLGetFileSystemRepresentation(url.get(), true, (unsigned char*)tmp, MAXPATHLEN)) {
AppendPathSeparator(tmp, lastof(tmp));
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = stredup(tmp);
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = tmp;
} else {
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL;
_searchpaths[SP_APPLICATION_BUNDLE_DIR].clear();
}
}