diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b409498..faa6ce2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,7 +143,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ github.run_number }} - release_name: Release v0.9.90 + release_name: Release v0.9.90-2 body: ${{ steps.read_release_notes.outputs.notes }} draft: false prerelease: false diff --git a/Leditor/Globals.cs b/Leditor/Globals.cs index ece930b..43228d1 100644 --- a/Leditor/Globals.cs +++ b/Leditor/Globals.cs @@ -183,7 +183,7 @@ internal static string AssetsDirectory { internal static System.Timers.Timer AutoSaveTimer = new(30_000); - internal const string Version = "Henry's Leditor v0.9.90"; + internal const string Version = "Henry's Leditor v0.9.90-2"; internal const string RaylibVersion = "Raylib v5.0.0"; internal static string BuildConfiguration { get; set; } = "Build Configuration: Unknown"; internal static string OperatingSystem { get; set; } = "Operating System: Unknown"; diff --git a/Leditor/Program.cs b/Leditor/Program.cs index 439e70b..bc6580d 100644 --- a/Leditor/Program.cs +++ b/Leditor/Program.cs @@ -721,11 +721,15 @@ private static void Main() var entries = Directory.GetFiles(Path.Combine(GLOBALS.Paths.RendererDirectory, "Props")); if (entries.Length > 0) { - var found = entries - .Select(Path.GetFileNameWithoutExtension) - .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); - - return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + try { + var found = entries + .Select(Path.GetFileNameWithoutExtension) + .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); + + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + } catch { + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); + } } return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); @@ -741,11 +745,15 @@ private static void Main() var entries = Directory.GetFiles(Path.Combine(GLOBALS.Paths.RendererDirectory, "Props")); if (entries.Length > 0) { - var found = entries - .Select(Path.GetFileNameWithoutExtension) - .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); - - return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + try { + var found = entries + .Select(Path.GetFileNameWithoutExtension) + .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); + + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + } catch { + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); + } } return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); @@ -761,11 +769,15 @@ private static void Main() var entries = Directory.GetFiles(Path.Combine(GLOBALS.Paths.RendererDirectory, "Props")); if (entries.Length > 0) { - var found = entries - .Select(Path.GetFileNameWithoutExtension) - .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); - - return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + try { + var found = entries + .Select(Path.GetFileNameWithoutExtension) + .SingleOrDefault(f => string.Equals(f, prop.Name, StringComparison.OrdinalIgnoreCase)); + + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", (found ?? prop.Name) + ".png"); + } catch { + return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); + } } return Path.Combine(GLOBALS.Paths.RendererDirectory, "Props", prop.Name + ".png"); diff --git a/Leditor/TileLoader.cs b/Leditor/TileLoader.cs index 63cb00a..4401acd 100644 --- a/Leditor/TileLoader.cs +++ b/Leditor/TileLoader.cs @@ -185,9 +185,13 @@ internal bool Proceed() var filePaths = Directory.GetFiles(pack.Directory, "*"); if (filePaths.Length > 0) { - var found = filePaths.SingleOrDefault(f => string.Equals(Path.GetFileNameWithoutExtension(f), tile.Name, StringComparison.OrdinalIgnoreCase)); + try { + var found = filePaths.SingleOrDefault(f => string.Equals(Path.GetFileNameWithoutExtension(f), tile.Name, StringComparison.OrdinalIgnoreCase)); - if (found is not null) tilePath = found; + if (found is not null) tilePath = found; + } catch { + tilePath = Path.Combine(pack.Directory, $"{tile.Name}.png"); + } } } // diff --git a/Release_Notes.txt b/Release_Notes.txt index 577d207..57d04b8 100644 --- a/Release_Notes.txt +++ b/Release_Notes.txt @@ -10,4 +10,9 @@ ### Fixes -- Fixed some tile textures not loading on Linux machines. \ No newline at end of file +- Fixed some tile textures not loading on Linux machines. + + +### Revision 0.9.90-2 + +- Fixed a crash that occurs when more than one texture share the same name. \ No newline at end of file