diff options
-rw-r--r-- | ui/gtk/webbrowser.c | 2 | ||||
-rw-r--r-- | ui/help_url.c | 27 | ||||
-rw-r--r-- | ui/help_url.h | 10 | ||||
-rw-r--r-- | wsutil/filesystem.c | 23 | ||||
-rw-r--r-- | wsutil/filesystem.h | 12 |
5 files changed, 37 insertions, 37 deletions
diff --git a/ui/gtk/webbrowser.c b/ui/gtk/webbrowser.c index c3488fdd75..36e94debf5 100644 --- a/ui/gtk/webbrowser.c +++ b/ui/gtk/webbrowser.c @@ -114,6 +114,8 @@ #include "ui/gtk/webbrowser.h" +#include <wsutil/filesystem.h> + #if defined(G_OS_WIN32) /* Win32 - use Windows shell services to start a browser */ #include <windows.h> diff --git a/ui/help_url.c b/ui/help_url.c index af12f19c9e..059682d976 100644 --- a/ui/help_url.c +++ b/ui/help_url.c @@ -36,33 +36,6 @@ #include <wsutil/unicode-utils.h> #endif -/* - * Given a filename return a filesystem URL. Relative paths are prefixed with - * the datafile directory path. - */ -gchar * -data_file_url(const gchar *filename) -{ - gchar *file_path; - gchar *uri; - - /* Absolute path? */ - if(g_path_is_absolute(filename)) { - file_path = g_strdup(filename); - } else if(running_in_build_directory()) { - file_path = g_strdup_printf("%s/doc/%s", get_datafile_dir(), filename); - } else { - file_path = g_strdup_printf("%s/%s", get_datafile_dir(), filename); - } - - /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */ - - /* convert filename to uri */ - uri = g_filename_to_uri(file_path, NULL, NULL); - g_free(file_path); - return uri; -} - const char * topic_online_url(topic_action_e action) { diff --git a/ui/help_url.h b/ui/help_url.h index 213ef65fb8..d75898d762 100644 --- a/ui/help_url.h +++ b/ui/help_url.h @@ -124,16 +124,6 @@ typedef enum { HELP_TELEPHONY_RTP_PLAYER_DIALOG } topic_action_e; -/** Given a filename return a filesystem URL. Relative paths are prefixed with - * the datafile directory path. - * - * @param filename A file name or path. Relative paths will be prefixed with - * the data file directory path. - * @return A filesystem URL for the file or NULL on failure. A non-NULL return - * value must be freed with g_free(). - */ -gchar *data_file_url(const gchar *filename); - /** Given a topic action return its online (www.wireshark.org) URL or NULL. * * @param action Topic action, e.g. ONLINEPAGE_HOME or ONLINEPAGE_ASK. diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index ed8b8c18c2..a7b2329f90 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -2121,6 +2121,29 @@ done: return FALSE; } +gchar * +data_file_url(const gchar *filename) +{ + gchar *file_path; + gchar *uri; + + /* Absolute path? */ + if(g_path_is_absolute(filename)) { + file_path = g_strdup(filename); + } else if(running_in_build_directory()) { + file_path = g_strdup_printf("%s/doc/%s", get_datafile_dir(), filename); + } else { + file_path = g_strdup_printf("%s/%s", get_datafile_dir(), filename); + } + + /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */ + + /* convert filename to uri */ + uri = g_filename_to_uri(file_path, NULL, NULL); + g_free(file_path); + return uri; +} + /* * Editor modelines * diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 137f0dae63..a45367a69b 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -292,6 +292,18 @@ WS_DLL_PUBLIC gboolean files_identical(const char *fname1, const char *fname2); WS_DLL_PUBLIC gboolean copy_file_binary_mode(const char *from_filename, const char *to_filename); + +/* + * Given a filename return a filesystem URL. Relative paths are prefixed with + * the datafile directory path. + * + * @param filename A file name or path. Relative paths will be prefixed with + * the data file directory path. + * @return A filesystem URL for the file or NULL on failure. A non-NULL return + * value must be freed with g_free(). + */ +WS_DLL_PUBLIC gchar* data_file_url(const gchar *filename); + #ifdef __cplusplus } #endif /* __cplusplus */ |