checking personal xml file exist 97/318097/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 24 Sep 2024 11:34:15 +0000 (20:34 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Tue, 24 Sep 2024 11:37:40 +0000 (20:37 +0900)
Before checking the access about personal xml file, check the existance first.
If there is no file and no personal voice list, it is not an error.
Only accessing fail and parsing error are defined an error.

Change-Id: I9eb1cff2a39e02a11b2bb0141c0ad292c3f0171d

common/tts_config_mgr.c
common/tts_config_parser.c

index aae206a641d35a6c34ed993bf58b11caf92c3f1c..a28f407e4e182566dc5af3f7cd3587d8e53deb9c 100644 (file)
@@ -2242,8 +2242,7 @@ int __tts_config_mgr_print_personal_info(const char* engine_id)
                        j++;
                }
        } else {
-               tts_parser_free_personal_info(info);
-               return -1;
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices");
        }
 
        tts_parser_free_personal_info(info);
@@ -2508,9 +2507,7 @@ int tts_config_mgr_get_personal_voice_list(const char* engine_id, tts_config_sup
                        j++;
                }
        } else {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] No personal voices list");
-               tts_parser_free_personal_info(info);
-               return TTS_CONFIG_ERROR_INVALID_VOICE;
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices");
        }
 
        tts_parser_free_personal_info(info);
@@ -2560,8 +2557,9 @@ int tts_config_mgr_check_duplicate_personal_voice(const char* engine_id, const c
                        j++;
                }
        } else {
-               return -1;
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices");
        }
 
+       tts_parser_free_personal_info(info);
        return 0;
 }
\ No newline at end of file
index deb271a6179e7af66e7af670da0e9e92adc9911e..f08370881ed9ac1d4a97f979c9af15e9cd99c5ed 100644 (file)
@@ -258,6 +258,13 @@ int tts_parser_get_personal_info(const char* path, tts_personal_info_s** persona
        xmlDocPtr doc = NULL;
        xmlNodePtr cur = NULL;
 
+       struct stat sb;
+       int ret = stat(path, &sb);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal xml file");
+               return 0;
+       }
+
        if (0 == access(path, F_OK)) {
                SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Success to access to %s", path);
                doc = xmlParseFile(path);