net-misc/rustdesk: update deps
[gentoo-zh.git] / app-i18n / mozc / files / mozc-2.26.4632-environmental_variables.patch
blob7377dd41cb147312bac9bd244e9ded381fcfbf6d
1 https://github.com/google/mozc/issues/470
3 --- a/src/base/system_util.cc 2022-06-27 02:02:49.363848587 +0800
4 +++ b/src/base/system_util.cc 2022-06-27 02:25:41.701524057 +0800
5 @@ -239,6 +239,11 @@
7 std::string UserProfileDirectoryImpl::GetUserProfileDirectory() const {
8 #if defined(OS_CHROMEOS)
9 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
10 + if (configuration_dir_env) {
11 + return configuration_dir_env;
12 + }
14 // TODO(toka): Must use passed in user profile dir which passed in. If mojo
15 // platform the user profile is determined on runtime.
16 // It's hack, the user profile dir should be passed in. Although the value in
17 @@ -258,13 +263,23 @@
18 #elif defined(OS_IOS)
19 // OS_IOS block must be placed before __APPLE__ because both macros are
20 // currently defined on iOS.
21 - //
23 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
24 + if (configuration_dir_env) {
25 + return configuration_dir_env;
26 + }
28 // On iOS, use Caches directory instead of Application Spport directory
29 // because the support directory doesn't exist by default. Also, it is backed
30 // up by iTunes and iCloud.
31 return FileUtil::JoinPath({MacUtil::GetCachesDirectory(), kProductPrefix});
33 #elif defined(OS_WIN)
34 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
35 + if (configuration_dir_env) {
36 + return configuration_dir_env;
37 + }
39 DCHECK(SUCCEEDED(Singleton<LocalAppDataDirectoryCache>::get()->result()));
40 std::string dir = Singleton<LocalAppDataDirectoryCache>::get()->path();
42 @@ -277,6 +292,11 @@
43 return FileUtil::JoinPath(dir, kProductNameInEnglish);
45 #elif defined(__APPLE__)
46 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
47 + if (configuration_dir_env) {
48 + return configuration_dir_env;
49 + }
51 std::string dir = MacUtil::GetApplicationSupportDirectory();
52 #ifdef GOOGLE_JAPANESE_INPUT_BUILD
53 dir = FileUtil::JoinPath(dir, "Google");
54 @@ -289,6 +309,11 @@
55 #endif // GOOGLE_JAPANESE_INPUT_BUILD
57 #elif defined(OS_LINUX)
58 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
59 + if (configuration_dir_env) {
60 + return configuration_dir_env;
61 + }
63 // 1. If "$HOME/.mozc" already exists,
64 // use "$HOME/.mozc" for backward compatibility.
65 // 2. If $XDG_CONFIG_HOME is defined
66 @@ -421,6 +446,11 @@
67 #endif // OS_WIN
69 std::string SystemUtil::GetServerDirectory() {
70 + const char *server_dir_env = Environ::GetEnv("MOZC_SERVER_DIR");
71 + if (server_dir_env) {
72 + return server_dir_env;
73 + }
75 #ifdef OS_WIN
76 DCHECK(SUCCEEDED(Singleton<ProgramFilesX86Cache>::get()->result()));
77 #if defined(GOOGLE_JAPANESE_INPUT_BUILD)
78 @@ -477,6 +507,11 @@
81 std::string SystemUtil::GetDocumentDirectory() {
82 + const char *documents_dir_env = Environ::GetEnv("MOZC_DOCUMENTS_DIR");
83 + if (documents_dir_env) {
84 + return documents_dir_env;
85 + }
87 #if defined(OS_LINUX)
89 #ifndef MOZC_DOCUMENT_DIR