macOS: Fix loading fonts from user home ~/Library/Fonts dir

This commit is contained in:
David Capello 2018-08-15 13:35:01 -03:00
parent 360172d7ba
commit 6b7ba57ba2

View File

@ -10,12 +10,20 @@
#include "app/font_path.h" #include "app/font_path.h"
#include "base/fs.h"
#include <cstdlib>
namespace app { namespace app {
// TODO use a Cocoa API to get the list of paths
void get_font_dirs(base::paths& fontDirs) void get_font_dirs(base::paths& fontDirs)
{ {
// TODO use a Cocoa API to get the list of paths const char* home = std::getenv("HOME");
fontDirs.push_back("~/Library/Fonts"); if (home) {
fontDirs.push_back(
base::join_path(home, "Library/Fonts"));
}
fontDirs.push_back("/Library/Fonts"); fontDirs.push_back("/Library/Fonts");
fontDirs.push_back("/System/Library/Fonts/"); fontDirs.push_back("/System/Library/Fonts/");
} }