mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-07 08:24:47 -04:00
OSX bundled font fix-up
This commit is contained in:
+11
-11
@@ -149,17 +149,17 @@ bool CubicSDR::OnInit() {
|
||||
//better (by default, was "C" locale).
|
||||
std::setlocale(LC_ALL, "");
|
||||
|
||||
#ifdef _OSX_APP_
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
char path[PATH_MAX];
|
||||
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
||||
{
|
||||
// error!
|
||||
}
|
||||
CFRelease(resourcesURL);
|
||||
chdir(path);
|
||||
#endif
|
||||
//#ifdef _OSX_APP_
|
||||
// CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
// CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
// char path[PATH_MAX];
|
||||
// if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
||||
// {
|
||||
// // error!
|
||||
// }
|
||||
// CFRelease(resourcesURL);
|
||||
// chdir(path);
|
||||
//#endif
|
||||
|
||||
if (!wxApp::OnInit()) {
|
||||
return false;
|
||||
|
||||
+18
-1
@@ -5,6 +5,10 @@
|
||||
#include <algorithm>
|
||||
#include "cubic_math.h"
|
||||
|
||||
#ifdef _OSX_APP_
|
||||
#include "CoreFoundation/CoreFoundation.h"
|
||||
#endif
|
||||
|
||||
static std::wstring getExePath(void)
|
||||
{
|
||||
//get the dir path of the executable
|
||||
@@ -201,8 +205,21 @@ void GLFont::loadFontOnce() {
|
||||
return;
|
||||
}
|
||||
|
||||
#if _OSX_APP_
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
char path[PATH_MAX];
|
||||
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
||||
{
|
||||
// error!
|
||||
}
|
||||
CFRelease(resourcesURL);
|
||||
wxString resourceFolder = std::string(path) + "/";
|
||||
|
||||
#else
|
||||
wxString resourceFolder = RES_FOLDER;
|
||||
|
||||
#endif
|
||||
|
||||
//full font file path
|
||||
wxFileName fontDefFileName = wxFileName(resourceFolder + L"/" + fontDefFileSource);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user