about summary refs log tree commit diff
path: root/src/game/editor/ed_editor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/editor/ed_editor.h')
-rw-r--r--src/game/editor/ed_editor.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h
index fb4cd50e..6ff9e6c8 100644
--- a/src/game/editor/ed_editor.h
+++ b/src/game/editor/ed_editor.h
@@ -680,6 +680,21 @@ public:
 
 	void AddFileDialogEntry(int Index, CUIRect *pView);
 	void SortImages();
+	static void ExtractName(const char *pFileName, char *pName, int BufferSize)
+	{
+		const char *pExtractedName = pFileName;
+		const char *pEnd = 0;
+		for(; *pFileName; ++pFileName)
+		{
+			if(*pFileName == '/' || *pFileName == '\\')
+				pExtractedName = pFileName+1;
+			else if(*pFileName == '.')
+				pEnd = pFileName;
+		}
+
+		int Length = pEnd > pExtractedName ? min(BufferSize, (int)(pEnd-pExtractedName+1)) : BufferSize;
+		str_copy(pName, pExtractedName, Length);
+	}
 };
 
 // make sure to inline this function