From 5098f7a174cae2b6a63c46adee304f86ad711195 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 6 Dec 2007 20:03:27 +0000 Subject: [PATCH] fix file_path issues git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6546 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_config.c | 4 ++-- src/switch_core_asr.c | 2 +- src/switch_core_db.c | 2 +- src/switch_ivr_originate.c | 6 +++--- src/switch_loadable_module.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/switch_config.c b/src/switch_config.c index aa4d16bb90..48608d5aee 100644 --- a/src/switch_config.c +++ b/src/switch_config.c @@ -38,7 +38,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa char *path = NULL; char path_buf[1024]; - if (file_path[0] == '/') { + if (switch_is_file_path(file_path)) { path = file_path; } else { snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path); @@ -53,7 +53,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa cfg->lockto = -1; if (!(f = fopen(path, "r"))) { - if (file_path[0] != '/') { + if (!switch_is_file_path(file_path)) { int last = -1; char *var, *val; diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index a3324e9b06..cb489d6bd2 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -88,7 +88,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t assert(ah != NULL); - if (*path != '/') { + if (!switch_is_file_path(path)) { epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path); path = epath; } diff --git a/src/switch_core_db.c b/src/switch_core_db.c index 8dd2bca339..2474952091 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -39,7 +39,7 @@ static void db_pick_path(char *dbname, char *buf, switch_size_t size) { memset(buf, 0, size); - if (strchr(dbname, '/')) { + if (switch_is_file_path(dbname)) { strncpy(buf, dbname, size); } else { snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index fba1648513..047f44fd38 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -635,10 +635,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0); switch_buffer_set_loops(ringback.audio_buffer, -1); - - if (*ringback_data == '/') { + + if (switch_is_file_path(ringback_data)) { char *ext; - + if ((ext = strrchr(ringback_data, '.'))) { switch_core_session_set_read_codec(session, &write_codec); ext++; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index baf491ed25..d7f8f10a75 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -770,7 +770,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch return SWITCH_STATUS_FALSE; } - if (*file == '/') { + if (switch_is_file_path(file)) { path = switch_core_strdup(loadable_modules.pool, file); file = (char *)switch_cut_path(file); if ((dot = strchr(file, '.'))) {