[gnome-boxes] installed-media: Handle device nodes (/dev/..)



commit 50ab9286ce00f0cdc543ec6e522d6edbf9caf308
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Jul 21 23:03:21 2015 +0100

    installed-media: Handle device nodes (/dev/..)
    
    Device files don't have any extension so we have been ignoring them.
    Since we ensure we get the read access to the media during import
    already, we should be handling real device files too.

 src/installed-media.vala |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/installed-media.vala b/src/installed-media.vala
index a5f75db..e1102b9 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -37,11 +37,15 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
 
     public InstalledMedia (string path) throws GLib.Error {
         var supported = false;
-        foreach (var extension in supported_extensions) {
-            supported = path.has_suffix (extension);
-            if (supported)
-                break;
-        }
+
+        if (path.has_prefix ("/dev/"))
+            supported = true; // Let's assume it's device file in raw format
+        else
+            foreach (var extension in supported_extensions) {
+                supported = path.has_suffix (extension);
+                if (supported)
+                    break;
+            }
 
         if (!supported)
             throw new IOError.NOT_SUPPORTED (_("Unsupported disk image format."));


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