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



commit 571eff25f968869a20e873a7d0a444121471d477
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Nov 9 11:16:50 2013 +0100

    [backends/jscommon] Clean paths

 .../gnome/codeassistance/transport_dbus.js         |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/backends/jscommon/gnome/codeassistance/transport_dbus.js 
b/backends/jscommon/gnome/codeassistance/transport_dbus.js
index 4040d24..f502823 100644
--- a/backends/jscommon/gnome/codeassistance/transport_dbus.js
+++ b/backends/jscommon/gnome/codeassistance/transport_dbus.js
@@ -225,9 +225,19 @@ Server.prototype = {
         }
     },
 
+    _clean_path: function(path) {
+        if (path.length == 0) {
+            return path;
+        }
+
+        return Gio.file_new_for_path(path).get_path();
+    },
+
     parse: function(app, path, cursor, unsaved, options) {
         var doc = null;
 
+        path = this._clean_path(path);
+
         if (path in app.ids) {
             doc = app.docs[app.ids[path]];
         }
@@ -236,8 +246,8 @@ Server.prototype = {
 
         for (var i = 0; i < unsaved.length; i++) {
             uns.push({
-                path: unsaved[i][0],
-                data_path: unsaved[i][1]
+                path: this._clean_path(unsaved[i][0]),
+                data_path: this._clean_path(unsaved[i][1])
             });
         }
 
@@ -285,6 +295,8 @@ Server.prototype = {
     },
 
     dispose_real: function(app, path) {
+        path = this._clean_path(path);
+
         if (path in app.ids) {
             var id = app.ids[path];
             var doc = app.docs[id];


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