gboolean ret;
/* decide what file to open (from dfilter code) */
- path = get_persconffile_path("colorfilters", TRUE, FALSE);
+ path = get_persconffile_path("colorfilters", TRUE);
if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
return FALSE;
}
- path = get_persconffile_path("colorfilters", TRUE, TRUE);
+ path = get_persconffile_path("colorfilters", TRUE);
if ((f = ws_fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor writing: %s.",
}
/* Construct the pathname of the user's disabled protocols file. */
- ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE, FALSE);
+ ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE);
/* If we already have a list of protocols, discard it. */
discard_existing_list (&disabled_protos);
*pref_path_return = NULL; /* assume no error */
- ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE, TRUE);
+ ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE);
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
/* set personal services path */
if (g_pservices_path == NULL)
- g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE, FALSE);
+ g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE);
parse_services_file(g_pservices_path);
* with it. It's used in get_ethbyname() and get_ethbyaddr()
*/
if (g_pethers_path == NULL)
- g_pethers_path = get_persconffile_path(ENAME_ETHERS, FALSE, FALSE);
+ g_pethers_path = get_persconffile_path(ENAME_ETHERS, FALSE);
/* manuf hash table initialization */
* with it. It's used in get_ipxnetbyname() and get_ipxnetbyaddr()
*/
if (g_pipxnets_path == NULL)
- g_pipxnets_path = get_persconffile_path(ENAME_IPXNETS, FALSE, FALSE);
+ g_pipxnets_path = get_persconffile_path(ENAME_IPXNETS, FALSE);
ipxnet_resolution_initialized = TRUE;
} /* initialize_ipxnets */
subnet_length_entries[i].mask = get_subnet_mask(length);
}
- subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE, FALSE);
+ subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE);
if (!read_subnets_file(subnetspath) && errno != ENOENT) {
report_open_failure(subnetspath, errno, FALSE);
}
* Load the user's hosts file, if they have one.
*/
if(!gbl_resolv_flags.load_hosts_file_from_profile_only){
- hostspath = get_persconffile_path(ENAME_HOSTS, TRUE, FALSE);
+ hostspath = get_persconffile_path(ENAME_HOSTS, TRUE);
if (!read_hosts_file(hostspath) && errno != ENOENT) {
report_open_failure(hostspath, errno, FALSE);
}
g_array_append_vals(ri.hf, base_hf, array_length(base_hf));
g_array_append_vals(ri.ett, base_ett, array_length(base_ett));
- dir = get_persconffile_path("radius", FALSE, FALSE);
+ dir = get_persconffile_path("radius", FALSE);
if (test_for_directory(dir) != EISDIR) {
/* Although dir isn't a directory it may still use memory */
xmlpi_xml_ns->elements = NULL;
- dirname = get_persconffile_path("dtds", FALSE, FALSE);
+ dirname = get_persconffile_path("dtds", FALSE);
if (test_for_directory(dirname) != EISDIR) {
/* Although dir isn't a directory it may still use memory */
* caller is done with it.
*/
char *
-get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_writing
-#ifndef _WIN32
- _U_
-#endif
-)
+get_persconffile_path(const char *filename, gboolean from_profile)
{
char *path;
-#ifdef _WIN32
- ws_statb64 s_buf;
- char *old_path;
-#endif
if (do_store_persconffiles && from_profile && !g_hash_table_lookup (profile_files, filename)) {
/* Store filenames so we know which filenames belongs to a configuration profile */
g_hash_table_insert (profile_files, g_strdup(filename), g_strdup(filename));
path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
get_persconffile_dir(NULL), filename);
}
-#ifdef _WIN32
- if (!for_writing) {
- if (ws_stat64(path, &s_buf) != 0 && errno == ENOENT) {
- /*
- * OK, it's not in the personal configuration file
- * directory; is it in the ".wireshark" subdirectory
- * of their home directory?
- */
- old_path = g_strdup_printf(
- "%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s",
- get_home_dir(), filename);
- if (ws_stat64(old_path, &s_buf) == 0) {
- /*
- * OK, it exists; return it instead.
- */
- g_free(path);
- path = old_path;
- }
- }
- }
-#endif
return path;
}
char *
get_plugins_pers_dir(void)
{
- return get_persconffile_path(PLUGINS_DIR_NAME, FALSE, FALSE);
+ return get_persconffile_path(PLUGINS_DIR_NAME, FALSE);
}
/* Delete a file */
* file name. If using configuration profiles this directory will be
* used if "from_profile" is TRUE.
*
- * On Win32, if "for_writing" is FALSE, we check whether the file exists
- * and, if not, construct a path name relative to the ".wireshark"
- * subdirectory of the user's home directory, and check whether that
- * exists; if it does, we return that, so that configuration files
- * from earlier versions can be read.
- *
* The returned file name was g_malloc()'d so it must be g_free()d when the
* caller is done with it.
*/
-WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_profile,
- gboolean for_writing);
+WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_profile);
/*
* Get the (default) directory in which personal data is stored.
#else
prefs_register_static_text_preference(nameres, "load_smi_modules_static",
- "Enable OID resolution: N/A",
+ "Enable OID resolution: N/A",
"Support for OID resolution was not compiled into this version of Wireshark");
prefs_register_static_text_preference(nameres, "suppress_smi_errors_static",
- "Suppress SMI errors: N/A",
+ "Suppress SMI errors: N/A",
"Support for OID resolution was not compiled into this version of Wireshark");
prefs_register_static_text_preference(nameres, "smi_module_path",
- "SMI (MIB and PIB) modules and paths: N/A",
+ "SMI (MIB and PIB) modules and paths: N/A",
"Support for OID resolution was not compiled into this version of Wireshark");
#endif
}
guint i;
path_str = g_string_new("");
-
+
if (!load_smi_modules) {
D(1,("OID resolution not enabled"));
return path_str->str;
g_string_append_printf(path_str, "%s;", path);
g_free (path);
- path = get_persconffile_path("snmp\\mibs", FALSE, FALSE);
+ path = get_persconffile_path("snmp\\mibs", FALSE);
g_string_append_printf(path_str, "%s", path);
g_free (path);
#else
}
/* Construct the pathname of the user's preferences file. */
- pf_path = get_persconffile_path(PF_NAME, TRUE, FALSE);
+ pf_path = get_persconffile_path(PF_NAME, TRUE);
/* Read the user's preferences file, if it exists. */
*pf_path_return = NULL;
*/
if (pf_path_return != NULL) {
- pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE);
+ pf_path = get_persconffile_path(PF_NAME, TRUE);
if ((pf = ws_fopen(pf_path, "w")) == NULL) {
*pf_path_return = pf_path;
return errno;
gchar *pers_fname = NULL;
if (! uat->from_global) {
- pers_fname = get_persconffile_path(uat->filename, uat->from_profile, for_writing);
+ pers_fname = get_persconffile_path(uat->filename, uat->from_profile);
}
if ((! for_writing ) && (! file_exists(pers_fname) )) {
G_LOG_LEVEL_MESSAGE|
G_LOG_LEVEL_INFO|
G_LOG_LEVEL_DEBUG),
- ops ? ops->logger : basic_logger,
+ ops ? ops->logger : basic_logger,
NULL);
if (!L) {
/* if we are indeed superuser run user scripts only if told to do so */
if ( (!started_with_special_privs()) || run_anyway ) {
- filename = get_persconffile_path("init.lua", FALSE, FALSE);
+ filename = get_persconffile_path("init.lua", FALSE);
if ((file_exists(filename))) {
lua_load_script(filename);
return g_strdup(fname_clean);
}
- filename = get_persconffile_path(fname_clean,FALSE,FALSE);
+ filename = get_persconffile_path(fname_clean,FALSE);
if ( file_exists(filename) ) {
return filename;
WSLUA_FUNCTION wslua_persconffile_path(lua_State* L) {
#define WSLUA_OPTARG_persconffile_path_FILENAME 1 /* A filename */
const char *fname = luaL_optstring(L, WSLUA_OPTARG_persconffile_path_FILENAME,"");
- char* filename = get_persconffile_path(fname,FALSE,FALSE);
+ char* filename = get_persconffile_path(fname,FALSE);
lua_pushstring(L,filename);
g_free(filename);
}
/* try to open personal "cfilters"/"dfilters" file */
- ff_path = get_persconffile_path(ff_name, TRUE, FALSE);
+ ff_path = get_persconffile_path(ff_name, TRUE);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Did that fail because the file didn't exist?
* a particular list.
*/
g_free(ff_path);
- ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE);
+ ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Did that fail because the file didn't exist?
return;
}
- ff_path = get_persconffile_path(ff_name, TRUE, TRUE);
+ ff_path = get_persconffile_path(ff_name, TRUE);
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
g_free(path);
/* pers conf */
- path = get_persconffile_path("", FALSE, FALSE);
+ path = get_persconffile_path("", FALSE);
about_folders_row(table, "Personal configuration", path,
"\"dfilters\", \"preferences\", \"ethers\", ...");
g_free(path);
return;
}
- daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE, TRUE);
+ daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
if ((daf = ws_fopen(daf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open decode_as_entries file\n\"%s\": %s.", daf_path,
decode_clear_all(FALSE);
}
- daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE, FALSE);
+ daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
if ((daf = ws_fopen(daf_path, "r")) != NULL) {
read_prefs_file(daf_path, daf, read_set_decode_as_entries, NULL);
fclose(daf);
#else
gtk_rc_parse(rc_file);
g_free(rc_file);
- rc_file = get_persconffile_path(RC_FILE, FALSE, FALSE);
+ rc_file = get_persconffile_path(RC_FILE, FALSE);
gtk_rc_parse(rc_file);
#endif
g_free(rc_file);
// #else
// gtk_rc_parse(rc_file);
// g_free(rc_file);
-// rc_file = get_persconffile_path(RC_FILE, FALSE, FALSE);
+// rc_file = get_persconffile_path(RC_FILE, FALSE);
// gtk_rc_parse(rc_file);
// #endif
// g_free(rc_file);
return FALSE;
}
- rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE);
+ rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path,
return FALSE;
}
- rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path,
recent.gui_fileopen_remembered_dir = NULL;
/* Construct the pathname of the user's recent common file. */
- rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+ rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
/* Read the user's recent common file, if it exists. */
*rf_path_return = NULL;
}
/* Construct the pathname of the user's profile recent file. */
- rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, FALSE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
/* Read the user's recent file, if it exists. */
*rf_path_return = NULL;
* know what's supposed to happen at this point.
* ToDo: Determine if the "recent common file" should be read at this point
*/
- rf_common_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+ rf_common_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
if (!file_exists(rf_common_path)) {
/* Read older common settings from recent file */
rf = ws_fopen(rf_path, "r");
/* Construct the pathname of the user's recent common file. */
- rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+ rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
if (!file_exists (rf_path)) {
/* Recent common file does not exist, read from default recent */
g_free (rf_path);
- rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, FALSE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
}
/* Read the user's recent file, if it exists. */
/* build update file name */
/* XXX - using the personal path, use temp dir instead? */
- local_file = get_persconffile_path("wsupdate", FALSE, TRUE /*for_writing*/);
+ local_file = get_persconffile_path("wsupdate", FALSE);
if(local_file == NULL) {
g_warning("Couldn't create output path!");
return;