foxygit / doom Log in
commit 78886030b9a08a39f46e0e53b64194b59813f21c
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Jan 7 14:20:59 2019 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Jan 7 14:20:59 2019 +0100

    save a WAD file's filename in struct wad_file
---
 src/w_file.h | 3 +++
 src/w_wad.c  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/w_file.h b/src/w_file.h
index e31ceaf0..c883f4af 100644
--- a/src/w_file.h
+++ b/src/w_file.h
@@ -53,6 +53,9 @@ struct _wad_file_s

     // File's location on disk.
     const char *path;
+
+    // [crispy] name of this file
+    const char *basename;
 };

 // Open the specified file. Returns a pointer to a new wad_file_t
diff --git a/src/w_wad.c b/src/w_wad.c
index a9ba74b0..8eb7f07f 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -140,6 +140,9 @@ wad_file_t *W_AddFile (const char *filename)
 	return NULL;
     }

+    // [crispy] save the file name
+    wad_file->basename = M_BaseName(wad_file->path);
+
     if (strcasecmp(filename+strlen(filename)-3 , "wad" ) )
     {
 	// single lump file