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
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;
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
19 // OS_IOS block must be placed before __APPLE__ because both macros are
20 // currently defined on iOS.
23 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
24 + if (configuration_dir_env) {
25 + return configuration_dir_env;
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});
34 + const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
35 + if (configuration_dir_env) {
36 + return configuration_dir_env;
39 DCHECK(SUCCEEDED(Singleton<LocalAppDataDirectoryCache>::get()->result()));
40 std::string dir = Singleton<LocalAppDataDirectoryCache>::get()->path();
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;
51 std::string dir = MacUtil::GetApplicationSupportDirectory();
52 #ifdef GOOGLE_JAPANESE_INPUT_BUILD
53 dir = FileUtil::JoinPath(dir, "Google");
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;
63 // 1. If "$HOME/.mozc" already exists,
64 // use "$HOME/.mozc" for backward compatibility.
65 // 2. If $XDG_CONFIG_HOME is defined
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;
76 DCHECK(SUCCEEDED(Singleton<ProgramFilesX86Cache>::get()->result()));
77 #if defined(GOOGLE_JAPANESE_INPUT_BUILD)
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;
89 #ifndef MOZC_DOCUMENT_DIR