[gnome-code-assistance] [backends/rbcommon] Clean paths



commit bcfa532da151134ca56637a40ba0699b28fcffa5
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Nov 9 11:05:17 2013 +0100

    [backends/rbcommon] Clean paths

 .../gnome/codeassistance/transport/dbus.rb         |    9 +++++++++
 backends/rbcommon/gnome/codeassistance/types.rb    |   15 +++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/backends/rbcommon/gnome/codeassistance/transport/dbus.rb 
b/backends/rbcommon/gnome/codeassistance/transport/dbus.rb
index 1293dc2..6d5ac03 100644
--- a/backends/rbcommon/gnome/codeassistance/transport/dbus.rb
+++ b/backends/rbcommon/gnome/codeassistance/transport/dbus.rb
@@ -17,6 +17,7 @@
 
 require 'dbus'
 require 'gnome/codeassistance/types'
+require 'pathname'
 
 module Gnome; end
 
@@ -119,6 +120,10 @@ module Gnome::CodeAssistance
             dbus_method :Dispose, "in path:s" do |path|
                 a = app(@sender)
 
+                if path.length != 0
+                    path = Pathname.new(path).cleanpath.to_s
+                end
+
                 if a.ids.include?(path)
                     id = a.ids[path]
                     dispose_document(a.docs[id])
@@ -164,6 +169,10 @@ module Gnome::CodeAssistance
             a = app(@sender)
             doc = nil
 
+            if path.length != 0
+                path = Pathname.new(path).cleanpath.to_s
+            end
+
             if a.ids.include?(path)
                 docid = a.ids[path]
                 doc = a.docs[docid]
diff --git a/backends/rbcommon/gnome/codeassistance/types.rb b/backends/rbcommon/gnome/codeassistance/types.rb
index 6028f45..5c1327d 100644
--- a/backends/rbcommon/gnome/codeassistance/types.rb
+++ b/backends/rbcommon/gnome/codeassistance/types.rb
@@ -15,6 +15,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+require 'pathname'
+
 module Gnome; end
 
 module Gnome::CodeAssistance
@@ -22,8 +24,17 @@ module Gnome::CodeAssistance
         attr_accessor :path, :data_path
 
         def initialize(path='', data_path='')
-            @path = path
-            @data_path = data_path
+            if path.length != 0
+                @path = Pathname.new(path).cleanpath.to_s
+            else
+                @path = path
+            end
+
+            if data_path.length != 0
+                @data_path = Pathname.new(data_path).cleanpath.to_s
+            else
+                @data_path = data_path
+            end
         end
 
         def to_s


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