Fixed duplicate files listed in BGM/ME pickers in PBS file editors

This commit is contained in:
Maruno17
2022-06-20 08:44:18 +01:00
parent 03ffae6eed
commit 76639c4ba5
2 changed files with 4 additions and 7 deletions

View File

@@ -514,7 +514,8 @@ def pbSelectSE(canvas, audio)
animfiles.concat(Dir.glob("*.ogg")) animfiles.concat(Dir.glob("*.ogg"))
animfiles.concat(Dir.glob("*.wma")) animfiles.concat(Dir.glob("*.wma"))
} }
animfiles.sort! { |a, b| a.upcase <=> b.upcase } animfiles.uniq!
animfiles.sort! { |a, b| a.downcase <=> b.downcase }
animfiles = [_INTL("[Play user's cry]")] + animfiles animfiles = [_INTL("[Play user's cry]")] + animfiles
cmdwin = pbListWindow(animfiles, 320) cmdwin = pbListWindow(animfiles, 320)
cmdwin.height = 480 cmdwin.height = 480

View File

@@ -224,17 +224,13 @@ class MusicFileLister
@commands.clear @commands.clear
Dir.chdir(folder) { Dir.chdir(folder) {
# Dir.glob("*.mp3") { |f| @commands.push(f) } # Dir.glob("*.mp3") { |f| @commands.push(f) }
# Dir.glob("*.MP3") { |f| @commands.push(f) }
Dir.glob("*.ogg") { |f| @commands.push(f) } Dir.glob("*.ogg") { |f| @commands.push(f) }
Dir.glob("*.OGG") { |f| @commands.push(f) }
Dir.glob("*.wav") { |f| @commands.push(f) } Dir.glob("*.wav") { |f| @commands.push(f) }
Dir.glob("*.WAV") { |f| @commands.push(f) }
Dir.glob("*.mid") { |f| @commands.push(f) } Dir.glob("*.mid") { |f| @commands.push(f) }
Dir.glob("*.MID") { |f| @commands.push(f) }
Dir.glob("*.midi") { |f| @commands.push(f) } Dir.glob("*.midi") { |f| @commands.push(f) }
Dir.glob("*.MIDI") { |f| @commands.push(f) }
} }
@commands.sort! @commands.uniq!
@commands.sort! { |a, b| a.downcase <=> b.downcase }
@commands.length.times do |i| @commands.length.times do |i|
@index = i if @commands[i] == @setting @index = i if @commands[i] == @setting
end end