diff options
author | Stefan Gartner <stefang@aon.at> | 2003-05-12 22:12:25 +0400 |
---|---|---|
committer | Stefan Gartner <stefang@aon.at> | 2003-05-12 22:12:25 +0400 |
commit | eca049b177e08a0b8a182cc373e2ae225f7f8a11 (patch) | |
tree | cabf6402c17f3555afa40d4e56b1bddabd295d70 /source/blender/src/language.c | |
parent | 936f7541c47298c326f34548d4142005d5a478e1 (diff) |
store locales, .Blanguage, and .bfont.ttf inside of Resources folder of
application bundle on OS X
Diffstat (limited to 'source/blender/src/language.c')
-rw-r--r-- | source/blender/src/language.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/source/blender/src/language.c b/source/blender/src/language.c index bb1ca0b8705..416b87f8a28 100644 --- a/source/blender/src/language.c +++ b/source/blender/src/language.c @@ -128,7 +128,7 @@ void lang_setlanguage(void) { LANGMenuEntry *lme; lme = find_language(U.language); - if(lme) FTF_SetLanguage(lme->code); + if(lme) FTF_SetLanguage(lme->code); else FTF_SetLanguage("en_US"); } @@ -154,11 +154,14 @@ void set_interface_font(char *str) { void start_interface_font(void) { char tstr[FILE_MAXDIR+FILE_MAXFILE]; int result = 0; - +#ifdef __APPLE__ + char *bundlepath; +#endif + /* hack to find out if we have saved language/font settings. if not, set defaults and try .bfont.tff --phase */ - if(U.fontsize != 0) { // we have saved user settings + if(U.fontsize != 0) { // we have saved user settings // try load the font from the font dir BLI_make_file_string("/", tstr, U.fontdir, U.fontname); result = FTF_SetFont(tstr, U.fontsize); @@ -170,9 +173,20 @@ void start_interface_font(void) { U.language= 0; U.fontsize= 11; U.encoding= 0; + +#ifdef __APPLE__ + bundlepath = BLI_getbundle(); + strcpy(tstr, bundlepath); + strcat(tstr, "/Contents/Resources/"); + strcat(tstr, ".bfont.ttf"); + result = FTF_SetFont(tstr, U.fontsize); + + sprintf(U.fontname, ".blender/.bfont.ttf\0"); +#else sprintf(U.fontname, ".blender/.bfont.ttf\0"); result = FTF_SetFont(U.fontname, U.fontsize); +#endif } if(result) { @@ -250,15 +264,22 @@ void puplang_insert_entry(char *line) int read_languagefile(void) { char name[FILE_MAXDIR+FILE_MAXFILE]; LinkNode *l, *lines; - + /* .Blanguages */ - BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages"); + lines= BLI_read_file_as_lines(name); if(lines == NULL) { - /* If not found in home, try .blender dir */ - strcpy(name, ".blender\\.Blanguages"); + /* If not found in home, try current dir + * (Resources folder of app bundle on OS X) */ +#ifdef __APPLE__ + char *bundlePath = BLI_getbundle(); + strcpy(name, bundlePath); + strcat(name, "/Contents/Resources/.Blanguages"); +#else + strcpy(name, ".blender/.Blanguages"); +#endif lines= BLI_read_file_as_lines(name); if(lines == NULL) { |