[gnome-boxes/gnome-3-8] wizard: Handle local paths to remote files



commit 157128e8fe95c4cd3e27118b57e091c6552d3d3d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Aug 21 23:38:43 2013 +0300

    wizard: Handle local paths to remote files
    
    There are two issues this patch fixes:
    
    * g_file_native() thinks of paths to locally mounted remote locations, as
      non-native so Boxes errors out if given such paths. This patch fixes
      the issue by replacing g_file_native() usage with a mannual check.
    
    * g_file_get_uri() gives us the remote URI even if you created the GFile
      argument using the local path of the remote file. This patch fixes the
      issue by using the original commandline argument if the argument is
      not a path rathan than URI.
    
    Also we restrict the path/URI to filesystems that we know libvirt/qemu
    can handle: local and mounted SMB shares.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688798

 src/app.vala    |   10 ++++++++--
 src/wizard.vala |    5 +++--
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index aae9222..a4e0e4b 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -292,8 +292,14 @@ private class Boxes.App: Boxes.UI {
 
             call_when_ready (() => {
                 var file = File.new_for_commandline_arg (arg);
-
-                if (file.query_exists () || Uri.parse_scheme (arg) != null)
+                var is_uri = (Uri.parse_scheme (arg) != null);
+
+                if (file.query_exists ()) {
+                    if (is_uri)
+                        wizard.open_with_uri (file.get_uri ());
+                    else
+                        wizard.open_with_uri (arg);
+                } else if (is_uri)
                     wizard.open_with_uri (file.get_uri ());
                 else
                     open (arg);
diff --git a/src/wizard.vala b/src/wizard.vala
index 9ff99f5..c99e0af 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -227,11 +227,12 @@ private class Boxes.Wizard: Boxes.UI {
             throw new Boxes.Error.INVALID ("empty location");
 
         var file = location.contains ("://")? File.new_for_uri (location) : File.new_for_path (location);
+        var path = file.get_path ();
 
-        if (file.is_native ()) {
+        if (path != null && (file.has_uri_scheme ("file") || file.has_uri_scheme ("smb"))) {
             // FIXME: We should able to handle non-local URIs here too
             if (!probing)
-                prepare_for_installer (file.get_path ());
+                prepare_for_installer (path);
         } else {
             bool uncertain;
             var uri = file.get_uri ();


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