Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2014-07-10 02:56:49 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2014-07-10 02:56:49 +0400
commit40b6df78512a1a42c468a63ad38810b3f6ae4a83 (patch)
tree599a777a9bc72bb9f589f02383215af0f508d151 /intern/locale
parentd56908df514da85848e9039cbddf4b6d2ee3a590 (diff)
Moved and deleted some code from GHOST Cocoa
moved locale query to the intern/locale module deleted some odd code that did not appear to be actually used relating to command line arguments
Diffstat (limited to 'intern/locale')
-rw-r--r--intern/locale/CMakeLists.txt6
-rw-r--r--intern/locale/boost_locale_wrapper.cpp3
-rw-r--r--intern/locale/boost_locale_wrapper.h6
-rw-r--r--intern/locale/osx_user_locale.mm22
4 files changed, 34 insertions, 3 deletions
diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt
index 217fe9a8c71..5a59f411b10 100644
--- a/intern/locale/CMakeLists.txt
+++ b/intern/locale/CMakeLists.txt
@@ -36,6 +36,12 @@ set(SRC
boost_locale_wrapper.h
)
+if(APPLE)
+ list(APPEND SRC
+ osx_user_locale.mm
+ )
+endif()
+
if(WITH_HEADLESS)
add_definitions(-DWITH_HEADLESS)
endif()
diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp
index 25843d60578..5eb2f7fe9d9 100644
--- a/intern/locale/boost_locale_wrapper.cpp
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -65,8 +65,7 @@ void bl_locale_set(const char *locale)
}
else {
#if defined(__APPLE__) && !defined(WITH_HEADLESS) && !defined(WITH_GHOST_SDL)
- extern char GHOST_user_locale[128]; // pulled from Ghost_SystemCocoa
- std::string locale_osx = GHOST_user_locale + std::string(".UTF-8");
+ std::string locale_osx = osx_user_locale() + std::string(".UTF-8");
_locale = gen(locale_osx.c_str());
#else
_locale = gen("");
diff --git a/intern/locale/boost_locale_wrapper.h b/intern/locale/boost_locale_wrapper.h
index ff3645a5983..f7bc7b45eb6 100644
--- a/intern/locale/boost_locale_wrapper.h
+++ b/intern/locale/boost_locale_wrapper.h
@@ -42,7 +42,11 @@ void bl_locale_init(const char *messages_path, const char *default_domain);
void bl_locale_set(const char *locale);
const char *bl_locale_get(void);
const char *bl_locale_pgettext(const char *msgctxt, const char *msgid);
-
+
+#if defined(__APPLE__) && !defined(WITH_HEADLESS) && !defined(WITH_GHOST_SDL)
+const char* osx_user_locale(void);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/locale/osx_user_locale.mm b/intern/locale/osx_user_locale.mm
new file mode 100644
index 00000000000..1ed33bb1713
--- /dev/null
+++ b/intern/locale/osx_user_locale.mm
@@ -0,0 +1,22 @@
+#include "boost_locale_wrapper.h"
+
+#import <Cocoa/Cocoa.h>
+
+#include <cstdlib>
+
+static char* user_locale = NULL;
+
+// get current locale
+const char* osx_user_locale()
+{
+ ::free(user_locale);
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ CFLocaleRef myCFLocale = CFLocaleCopyCurrent();
+ NSLocale * myNSLocale = (NSLocale *) myCFLocale;
+ [myNSLocale autorelease];
+ NSString *nsIdentifier = [myNSLocale localeIdentifier];
+ user_locale = ::strdup([nsIdentifier UTF8String]);
+ [pool drain];
+
+ return user_locale;
+}