aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-07-06 02:06:56 -0700
committerGuy Harris <guy@alum.mit.edu>2018-07-06 09:07:52 +0000
commitaab5ad074e88e3c03e438b2b9ff503191c6f6458 (patch)
tree7310dc5e287603159a2e3f3f1a198e3550a72526 /file.h
parent140f95a0ca95a1316d4b617998a6f36ea52431b6 (diff)
Fix the calculation of a file's "basename".
Strip off only extensions that correspond to file types we know about; QFileInfo::baseName() strips off *all* extensions, where "extension" is "anything preceded by a .", so it turns foo.bar.pcap.gz into foo, not foo.bar. We don't want that; instead, we strip off only those extensions that correspond to file types we know how to read, so we'd strip off .pcap.gz in foo.bar.pcap.gz, and strip off .pcap in foo.bar.pcap, leaving foo.bar in both cases. Change-Id: I5385921ad2f0fef815d52e9902fef15735fd9dae Reviewed-on: https://code.wireshark.org/review/28636 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.h')
-rw-r--r--file.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/file.h b/file.h
index 3088435a60..090528654b 100644
--- a/file.h
+++ b/file.h
@@ -276,6 +276,17 @@ cf_write_status_t cf_export_specified_packets(capture_file *cf,
gchar *cf_get_display_name(capture_file *cf);
/**
+ * Get a name that can be used to generate a file name from the
+ * capture file name. It's based on the displayable name, so it's
+ * UTF-8; if it ends with a suffix that's used by a file type libwiretap
+ * can read, we strip that suffix off.
+ *
+ * @param cf the capture file
+ * @return the base name (must be g_free'd)
+ */
+gchar *cf_get_basename(capture_file *cf);
+
+/**
* Set the source of the capture data for temporary files, e.g.
* "Interface eth0" or "Pipe from Pong"
*