Skip to content

Loading…

Remove File extension check that only causes failure. #1716

Merged
merged 1 commit into from

4 participants

@danzel

If you have a file named something like "button.down.png" and try load it with content.Load<Texture2D>("button.down") then we fail to load it as we detect it has an extension in the file name.

This check appears to be unnecessary as there is a check for the file existing a few lines above, also it differs from XNA behaviour, where files named like this work fine.

@mgbot

Can one of the admins verify this patch?

@mgbot

Can one of the admins verify this patch?

@Aranda

@mgbot test

@mgbot

Build results will soon be (or already are) available at: http://build.monogame.net/job/PullRequestTester/170/

@Aranda

Looks good to me. I can't see any reason to be disallowing file names with full stops. I guess it was added to catch out people who forget to remove the extension when calling ContentManager.Load. Since Xna supports this, we should too.

@totallyeviljake totallyeviljake merged commit edcfc7f into mono:develop

1 check passed

Details default Merged build finished.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 8, 2013
  1. @danzel
Showing with 0 additions and 9 deletions.
  1. +0 −9 MonoGame.Framework/Content/ContentTypeReader.cs
View
9 MonoGame.Framework/Content/ContentTypeReader.cs
@@ -114,12 +114,6 @@ internal static string Normalize(string fileName, string[] extensions)
if (files.Any(s => s == file))
return fileName;
- // Check the file extension
- if (!string.IsNullOrEmpty(Path.GetExtension(fileName)))
- {
- return null;
- }
-
// FirstOrDefault returns null as the default if the file is not found. This crashed Path.Combine so check
// for it first.
string file2 = files.FirstOrDefault(s => extensions.Any(ext => s.ToLower() == (file.ToLower() + ext)));
@@ -137,9 +131,6 @@ public static string Normalize(string fileName, string[] extensions)
if (File.Exists(fileName))
return fileName;
#endif
- // Check the file extension
- if (!string.IsNullOrEmpty(Path.GetExtension(fileName)))
- return null;
foreach (string ext in extensions)
{
Something went wrong with that request. Please try again.