Skip to content

Commit 7056fe3

Browse files
committed
Fixed issue with wrong value used for the smf file. Pymapconv expects the output file to be without extension which is now the case
1 parent 4ab6faf commit 7056fe3

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

MapCreationTool/MapCreationTool/Helpers/PathHelper.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ internal static string GetWorkDirFromFullMapPath(string fullMapPath)
5151
return result;
5252
}
5353

54+
internal static string GetFilePathWithoutExtension(string filePath)
55+
{
56+
FileInfo fileInfo = new FileInfo(filePath);
57+
string directoryPath = fileInfo.Directory.FullName;
58+
string fileName = Path.GetFileNameWithoutExtension(filePath);
59+
string result = Path.Combine(directoryPath, fileName);
60+
61+
return result;
62+
}
63+
5464
/// <summary>
5565
/// Returns true if the given map path is actually containing a map
5666
/// </summary>
@@ -60,7 +70,7 @@ internal static string GetWorkDirFromFullMapPath(string fullMapPath)
6070
/// No maps subdirectory -> Not a map
6171
/// A bit troublesome if the user stores their map in a related directory
6272
/// </remarks>
63-
internal static bool IsMapDirectory(string fullMapPath)
73+
internal static bool IsMapDirectory(string fullMapPath)
6474
{
6575
string mapsPath = Path.Combine(fullMapPath, "maps");
6676
if (!Directory.Exists(mapsPath))

MapCreationTool/MapCreationTool/MapConverter/ProjectSettingsToCompilerSettingsConverter.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
using MapCreationTool.Models;
1+
using MapCreationTool.Helpers;
2+
using MapCreationTool.Models;
23
using System;
34
using System.Collections.Generic;
5+
using System.IO;
46
using System.Linq;
57
using System.Text;
68
using System.Threading.Tasks;
@@ -39,7 +41,11 @@ public static PyMapCompilerSettings Convert(ProjectSettings projectSettings)
3941
CompilationSettings compSettings = projectSettings.CompilationSettings;
4042
PyMapCompilerSettings settings = new PyMapCompilerSettings();
4143
SettingsAdder adder = new SettingsAdder(settings);
42-
adder.AddSettingIfSet("-o", compSettings.OutSmfFilePath, true);
44+
45+
// we don't want the outsmfFilepath to have any extension. Therefore we remove it. It will be automatically added by pymapconv again
46+
string outSmtPath = PathHelper.GetFilePathWithoutExtension(compSettings.OutSmfFilePath);
47+
48+
adder.AddSettingIfSet("-o", outSmtPath, true);
4349
adder.AddSettingIfSet("-t", compSettings.DiffuseMapName, true);
4450
adder.AddSettingIfSet("-a", compSettings.HeightMapName, true);
4551
adder.AddSettingIfSet("-m", compSettings.MetalMapName, compSettings.UseMetalMap);

0 commit comments

Comments
 (0)