Tweak global/local user-symlinks
This commit is contained in:
parent
1c11697c5a
commit
a826b9a829
21
chatdir.scm
21
chatdir.scm
|
@ -164,28 +164,29 @@
|
||||||
#!optional (global? #t) (global-pairity? #t) (global-name #f))
|
#!optional (global? #t) (global-pairity? #t) (global-name #f))
|
||||||
(let* ([g-name (if global-name global-name username)]
|
(let* ([g-name (if global-name global-name username)]
|
||||||
[user-path (subpath root channel ".users" "all" username)]
|
[user-path (subpath root channel ".users" "all" username)]
|
||||||
|
(user-global-path (subpath user-path "global"))
|
||||||
[g-user-path (subpath root ".users" g-name)]
|
[g-user-path (subpath root ".users" g-name)]
|
||||||
[g-local-path (subpath g-user-path "local" channel)])
|
[g-local-path (subpath g-user-path "local" channel)])
|
||||||
(cond [(or (file-exists? user-path) (directory-exists? user-path)
|
(cond [(or (file-exists? user-path) (directory-exists? user-path)
|
||||||
(symbolic-link? user-path))
|
(symbolic-link? user-path))
|
||||||
#f]
|
#f]
|
||||||
|
|
||||||
;; If global, we gotta do some symlink dancing.
|
;; If global, we gotta do some symlink dancing.
|
||||||
[global?
|
[global?
|
||||||
(user-add! root g-name)
|
(user-add! root g-name)
|
||||||
(if global-pairity?
|
(if global-pairity?
|
||||||
(create-symbolic-link (subpath "../../../.users" g-name) user-path)
|
(create-symbolic-link (subpath "../../../.users" g-name) user-path)
|
||||||
(create-directory user-path #t))
|
(create-directory user-path #t))
|
||||||
|
(if (not (symbolic-link? user-global-path))
|
||||||
(create-symbolic-link (subpath "../../../../.users" g-name)
|
(create-symbolic-link (subpath "../../../../.users" g-name)
|
||||||
(subpath user-path "global"))]
|
user-global-path))
|
||||||
|
(if (not (symbolic-link? g-local-path))
|
||||||
|
(create-symbolic-link (subpath "../../../" channel ".users" "all" username)
|
||||||
|
g-local-path))]
|
||||||
|
|
||||||
;; This is a channel-only user, don't bother with symlink fanciness.
|
;; This is a channel-only user, don't bother with symlink fanciness.
|
||||||
[#t
|
[#t
|
||||||
(create-directory user-path #t)])
|
(create-directory user-path #t)])))
|
||||||
;; Link all of a global-pairity user's joined directories to its "local" dir.
|
|
||||||
(if (and global-pairity?
|
|
||||||
(not (symbolic-link? g-local-path)))
|
|
||||||
(create-symbolic-link
|
|
||||||
(subpath "../../../" channel ".users" "all" username)
|
|
||||||
(subpath g-user-path "local" channel)))))
|
|
||||||
|
|
||||||
|
|
||||||
;; Sets a file in the channel-user's directory to given value.
|
;; Sets a file in the channel-user's directory to given value.
|
||||||
|
@ -357,7 +358,9 @@
|
||||||
(directory-unique-file
|
(directory-unique-file
|
||||||
directory
|
directory
|
||||||
leaf
|
leaf
|
||||||
(number->string (+ (or (string->number suffix) 0)
|
(number->string (+ (or (and (string? suffix)
|
||||||
|
(string->number suffix))
|
||||||
|
0)
|
||||||
.1)))
|
.1)))
|
||||||
leaf)))
|
leaf)))
|
||||||
|
|
||||||
|
|
Reference in New Issue