mirror of
https://github.com/corda/corda.git
synced 2025-01-23 21:08:48 +00:00
Culture fixes ; Path extensions
This commit is contained in:
parent
2362235b4c
commit
0ff703d1c0
@ -69,6 +69,12 @@
|
|||||||
|
|
||||||
# ifndef WINAPI_FAMILY_PARTITION
|
# ifndef WINAPI_FAMILY_PARTITION
|
||||||
# define WINAPI_FAMILY_PARTITION(x) (x)
|
# define WINAPI_FAMILY_PARTITION(x) (x)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
|
|
||||||
|
# include "avian-interop.h"
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif // WINAPI_FAMILY
|
#endif // WINAPI_FAMILY
|
||||||
|
|
||||||
@ -401,8 +407,20 @@ Locale getLocale() {
|
|||||||
|
|
||||||
return Locale(lang, reg);
|
return Locale(lang, reg);
|
||||||
#else
|
#else
|
||||||
#pragma message("TODO: CultureInfo.CurrentCulture")
|
std::wstring culture = AvianInterop::GetCurrentUICulture();
|
||||||
|
char* cultureName = strdup(std::string(culture.begin(), culture.end()).c_str());
|
||||||
|
char* delimiter = strchr(cultureName, '-');
|
||||||
|
if(!delimiter)
|
||||||
|
{
|
||||||
|
free(cultureName);
|
||||||
return Locale("en", "US");
|
return Locale("en", "US");
|
||||||
|
}
|
||||||
|
const char* lang = cultureName;
|
||||||
|
const char* reg = delimiter + 1;
|
||||||
|
*delimiter = 0;
|
||||||
|
Locale locale(lang, reg);
|
||||||
|
free(cultureName);
|
||||||
|
return locale;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -607,8 +625,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
|
|||||||
GetTempPath(MAX_PATH, buffer);
|
GetTempPath(MAX_PATH, buffer);
|
||||||
r = e->NewStringUTF(buffer);
|
r = e->NewStringUTF(buffer);
|
||||||
# else
|
# else
|
||||||
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.Storage.ApplicationData.Current.TemporaryFolder")
|
std::wstring tmpDir = AvianInterop::GetTemporaryFolder();
|
||||||
r = 0;
|
r = e->NewString((const jchar*)tmpDir.c_str(), tmpDir.length());
|
||||||
# endif
|
# endif
|
||||||
} else if (strcmp(chars, "user.dir") == 0) {
|
} else if (strcmp(chars, "user.dir") == 0) {
|
||||||
# if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
# if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
@ -616,8 +634,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
|
|||||||
GetCurrentDirectory(MAX_PATH, buffer);
|
GetCurrentDirectory(MAX_PATH, buffer);
|
||||||
r = e->NewStringUTF(buffer);
|
r = e->NewStringUTF(buffer);
|
||||||
# else
|
# else
|
||||||
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.ApplicationModel.Package.Current.InstalledLocation")
|
std::wstring userDir = AvianInterop::GetInstalledLocation();
|
||||||
r = 0;
|
r = e->NewString((const jchar*)userDir.c_str(), userDir.length());
|
||||||
# endif
|
# endif
|
||||||
} else if (strcmp(chars, "user.home") == 0) {
|
} else if (strcmp(chars, "user.home") == 0) {
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
@ -630,8 +648,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
|
|||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.Storage.KnownFolders.DocumentsLibrary")
|
std::wstring userHome = AvianInterop::GetDocumentsLibraryLocation();
|
||||||
r = 0;
|
r = e->NewString((const jchar*)userHome.c_str(), userHome.length());
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
LPWSTR home = _wgetenv(L"USERPROFILE");
|
LPWSTR home = _wgetenv(L"USERPROFILE");
|
||||||
|
Loading…
Reference in New Issue
Block a user