[gnome-boxes/gnome-3-16] wizard: Case-insensitive check for file extension



commit ee852027b5020d3b11b3ca8401f01c8658f83e9f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Apr 14 14:30:05 2015 +0100

    wizard: Case-insensitive check for file extension
    
    File names and extensions could be in any case so lets check files'
    extensions in a case-insensitive way.
    
    This fixes out of the box support for latest Windows ISOs that have
    filenames in all caps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746764

 src/wizard.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index abb60db..7c269d7 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -277,12 +277,16 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
                 var supported = false;
                 var extensions = InstalledMedia.supported_extensions;
                 extensions += "iso";
-                foreach (var extension in extensions)
-                    if (path.has_suffix (extension)) {
+                foreach (var extension in extensions) {
+                    var path_casefolded = path.casefold ();
+                    var extension_casefolded = extension.casefold ();
+
+                    if (path_casefolded.has_suffix (extension_casefolded)) {
                         supported = true;
 
                         break;
                     }
+                }
                 if (!supported)
                     throw new Boxes.Error.INVALID (_("Unsupported file"));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]