Change engine-info directory and Change file mod 27/281727/1
authorsooyeon <sooyeon.kim@samsung.com>
Wed, 21 Sep 2022 05:52:13 +0000 (14:52 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Wed, 21 Sep 2022 05:52:13 +0000 (14:52 +0900)
Change-Id: Ie643075c6b2fd41044473ceab5f40e82b31e7446
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
common/tts_config_parser.c
engine-parser/src/tts-engine-language-pack-parser.c

index 35494f6f61a5639ab6de9d95e90d167295ddf11f..8d495b9bad8b4969869e299641813ae557940887 100644 (file)
@@ -559,7 +559,7 @@ int tts_parser_load_config(void)
                } while (0 != ret);
 
                /* Set mode */
-               if (0 > chmod(TTS_CONFIG, 0600)) {
+               if (0 > chmod(TTS_CONFIG, 0644)) {
                        SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
                }
 
@@ -663,7 +663,7 @@ int tts_parser_copy_xml(const char* original, const char* destination)
        }
 
        /* Set mode */
-       if (0 > chmod(destination, 0600)) {
+       if (0 > chmod(destination, 0644)) {
                SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
        }
 
index 19507b738df81543cfdf3d2f1ff0ba81c6b0b602..2199bc3cd8dd8b17204bb7f1853bd69d8ac19fbc 100644 (file)
 #define TTS_TAG_ENGINE_VOICE                   "voice"
 #define TTS_TAG_ENGINE_VOICE_TYPE              "type"
 
-#define TTS_CONFIG_BASE                tzplatform_mkpath(TZ_USER_HOME, "share/.voice")
-#define TTS_HOME               tzplatform_mkpath(TZ_USER_HOME, "share/.voice/tts")
-#define TTS_ENGINE_BASE                tzplatform_mkpath(TZ_USER_HOME, "share/.voice/tts/1.0")
-#define TTS_ENGINE_INFO                tzplatform_mkpath(TZ_USER_SHARE, ".voice/tts/1.0/engine-info")
+#define TTS_GLOBAL_CONFIG_BASE         tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice")
+#define TTS_GLOBAL_HOME                tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice/tts")
+#define TTS_GLOBAL_ENGINE_INFO         tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice/tts/engine-info")
 
 #define TTS_METADATA_LANGUAGE  "http://tizen.org/metadata/tts-engine-language-pack/language"
 
@@ -73,44 +72,35 @@ static int __save_engine_info_xml(const char *pkgid)
        LOGD("=== Save engine info doc");
 
        /* Make directories */
-       if (0 != access(TTS_CONFIG_BASE, F_OK)) {
-               if (0 != mkdir(TTS_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_CONFIG_BASE);
+       if (0 != access(TTS_GLOBAL_CONFIG_BASE, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_CONFIG_BASE);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_CONFIG_BASE);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_CONFIG_BASE);
                }
        }
 
-       if (0 != access(TTS_HOME, F_OK)) {
-               if (0 != mkdir(TTS_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_HOME);
+       if (0 != access(TTS_GLOBAL_HOME, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_HOME);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_HOME);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_HOME);
                }
        }
 
-       if (0 != access(TTS_ENGINE_BASE, F_OK)) {
-               if (0 != mkdir(TTS_ENGINE_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_ENGINE_BASE);
+       if (0 != access(TTS_GLOBAL_ENGINE_INFO, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_ENGINE_INFO);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_ENGINE_BASE);
-               }
-       }
-
-       if (0 != access(TTS_ENGINE_INFO, F_OK)) {
-               if (0 != mkdir(TTS_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_ENGINE_INFO);
-                       return -1;
-               } else {
-                       LOGD("Success to make directory : %s", TTS_ENGINE_INFO);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_ENGINE_INFO);
                }
        }
 
        char path[256] = {'\0',};
-       snprintf(path, 256, "%s/%s.xml", TTS_ENGINE_INFO, pkgid);
+       snprintf(path, 256, "%s/%s.xml", TTS_GLOBAL_ENGINE_INFO, pkgid);
        int ret = xmlSaveFormatFile(path, g_doc, 1);
        LOGD("xmlSaveFile (%d)", ret);
        LOGD("===");
@@ -121,7 +111,7 @@ static int __remove_engine_info_xml(const char *pkgid)
 {
        LOGD("=== Remove engine info doc");
        char path[256] = {'\0',};
-       snprintf(path, 256, "%s/%s.xml", TTS_ENGINE_INFO, pkgid);
+       snprintf(path, 256, "%s/%s.xml", TTS_GLOBAL_ENGINE_INFO, pkgid);
        if (0 == access(path, F_OK)) {
                LOGD("Remove engine info xml(%s)", path);
                remove(path);