emacs-diffs
[Top][All Lists]
Advanced

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

master ed543ca3e0: Implement abbreviate-file-name in Tramp for Google dr


From: Michael Albinus
Subject: master ed543ca3e0: Implement abbreviate-file-name in Tramp for Google drive
Date: Tue, 8 Mar 2022 11:28:40 -0500 (EST)

branch: master
commit ed543ca3e0c3c10cc0f7c0f4e8ce0ad514c10ec8
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Implement abbreviate-file-name in Tramp for Google drive
    
    * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-get-home-directory):
    Implement for Google drive.
---
 lisp/net/tramp-gvfs.el | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index acded25292..d6120d2bee 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1604,10 +1604,20 @@ If USER is a string, return its home directory instead 
of the
 user identified by VEC.  If there is no user specified in either
 VEC or USER, or if there is no home directory, return nil."
   (let ((localname
-        (tramp-get-connection-property vec "default-location" nil)))
-    (if (zerop (length localname))
-       (tramp-get-connection-property (tramp-get-process vec) "share" nil)
-      localname)))
+        (tramp-get-connection-property vec "default-location" nil))
+       result)
+    (cond
+     ((zerop (length localname))
+      (tramp-get-connection-property (tramp-get-process vec) "share" nil))
+     ;; Google-drive.
+     ((not (string-prefix-p "/" localname))
+      (dolist (item
+              (tramp-gvfs-get-directory-attributes
+               (tramp-make-tramp-file-name vec "/"))
+              result)
+       (when (string-equal (cdr (assoc "name" item)) localname)
+         (setq result (concat "/" (car item))))))
+     (t localname))))
 
 (defun tramp-gvfs-handle-get-remote-uid (vec id-format)
   "The uid of the remote connection VEC, in ID-FORMAT.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]