summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-10-12 00:12:00 +0200
committerLudovic Courtès <ludo@gnu.org>2018-10-12 00:13:14 +0200
commit1c795c4fd2c0f82892c5d1683de197868ecc5214 (patch)
treefda7f5a6339a785a42f8504d38e79229190b1abf
parent8155a209071f981fbf359975f463be4bcf8fa23e (diff)
downloadguix-1c795c4fd2c0f82892c5d1683de197868ecc5214.tar.gz
profiles: 'user-friendly-profile' now recognizes ~/.config/guix/current.
* guix/profiles.scm (%known-shorthand-profiles): New variable.
(user-friendly-profile): Use it.
-rw-r--r--guix/profiles.scm19
1 files changed, 13 insertions, 6 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 99e6fe7371..89e92ea2ba 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1665,13 +1665,20 @@ as if '-p' was omitted."  ; see <http://bugs.gnu.org/17939>
               profile)))
       (const profile))))
 
+(define %known-shorthand-profiles
+  ;; Known shorthand forms for profiles that the user manipulates.
+  (list (string-append (config-directory #:ensure? #f) "/current")
+        %user-profile-directory))
+
 (define (user-friendly-profile profile)
-  "Return either ~/.guix-profile if that's what PROFILE refers to, directly or
-indirectly, or PROFILE."
-  (if (and %user-profile-directory
-           (false-if-exception
-            (string=? (readlink %user-profile-directory) profile)))
-      %user-profile-directory
+  "Return either ~/.guix-profile or ~/.config/guix/current if that's what
+PROFILE refers to, directly or indirectly, or PROFILE."
+  (or (find (lambda (shorthand)
+              (and shorthand
+                   (let ((target (false-if-exception
+                                  (readlink shorthand))))
+                     (and target (string=? target profile)))))
+            %known-shorthand-profiles)
       profile))
 
 ;;; profiles.scm ends here