From 385338ec42703648cdd7acbf9651975b453eaadb Mon Sep 17 00:00:00 2001
From: biwa <6475593+biwa@users.noreply.github.com>
Date: Sat, 22 Aug 2020 22:00:17 +0200
Subject: [PATCH] OBJ Exporter: fixed a bug where the .mtl file also had .obj
 in its name

---
 Source/Plugins/BuilderModes/IO/WavefrontExporter.cs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
index 685a02dc7..1e137ae26 100755
--- a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
+++ b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs
@@ -264,8 +264,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
 				// Make sure the directory is there
 				Directory.CreateDirectory(Path.GetDirectoryName(savePath));
 
+				string mtlPath = Path.Combine(Path.GetDirectoryName(savePath), Path.GetFileNameWithoutExtension(savePath) + ".mtl");
+
 				// Write mtl (only if not exporting for GZDoom, since it will be ignored anyway
-				using (StreamWriter sw = new StreamWriter(savePath + ".mtl", false))
+				using (StreamWriter sw = new StreamWriter(mtlPath, false))
 					sw.Write(mtl.ToString());
 			}
 			else
@@ -348,7 +350,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
 			}
 
 			//done
-			General.Interface.DisplayStatus(StatusType.Warning, "Geometry exported to \"" + savePath + ".obj\"");
+			General.Interface.DisplayStatus(StatusType.Warning, "Geometry exported to \"" + savePath);
 		}
 
 		#endregion
-- 
GitLab