Skip to content

Commit 9c83cb7

Browse files
Make file extension checks case insensitive
1 parent 0d5b65c commit 9c83cb7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/AbletonMetadata.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class AbletonMetadata
1010
/// See https://help.ableton.com/hc/en-us/articles/211427589-Supported-Audio-File-Formats.
1111
/// </summary>
1212
private static List<string> supportedExtensions = new List<string>() {
13-
".wav", ".aiff", ".flac", ".ogg", ".mp3", ".mp4", ".m4a"
13+
".wav", ".wave", ".aif", ".aiff", ".flac", ".ogg", ".mp3", ".mp4", ".m4a"
1414
};
1515

1616
/// <summary>
@@ -23,7 +23,7 @@ public static class AbletonMetadata
2323
/// <returns>Whether or not the path is for metadata.</returns>
2424
public static bool IsMetadata(string path)
2525
{
26-
return path.Contains("Ableton Folder Info") || Path.GetExtension(path) == ".asd";
26+
return path.Contains("Ableton Folder Info") || Path.GetExtension(path).ToLower() == ".asd";
2727
}
2828

2929
/// <summary>
@@ -43,6 +43,6 @@ public static string GetXmpFilePath(string folder)
4343
/// <returns>Whether or not the file is supported by Live.</returns>
4444
public static bool IsSupportedSampleFormat(string filename)
4545
{
46-
return supportedExtensions.Contains(Path.GetExtension(filename));
46+
return supportedExtensions.Contains(Path.GetExtension(filename).ToLower());
4747
}
4848
}

test/AbletonMetadataTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public class AbletonMetadataTests
55
[Theory]
66
[InlineData("C:/foo/Ableton Folder Info/file.txt", true)]
77
[InlineData("C:/foo/metadata.asd", true)]
8+
[InlineData("C:/foo/metadata.ASD", true)]
89
[InlineData("C:/foo/sound.wav", false)]
910
public void ShouldDetectMetadata(string path, bool isValid)
1011
{
@@ -21,12 +22,15 @@ public void ShouldReturnXmpFilePath()
2122

2223
[Theory]
2324
[InlineData("sound.wav", true)]
25+
[InlineData("sound.wave", true)]
26+
[InlineData("sound.aif", true)]
2427
[InlineData("sound.aiff", true)]
2528
[InlineData("sound.flac", true)]
2629
[InlineData("sound.ogg", true)]
2730
[InlineData("sound.mp3", true)]
2831
[InlineData("sound.mp4", true)]
2932
[InlineData("sound.m4a", true)]
33+
[InlineData("sound.WAV", true)]
3034
[InlineData("sound.exe", false)]
3135
public void ShouldDetectSampleFiles(string filename, bool isValid)
3236
{

0 commit comments

Comments
 (0)