changeset 648: | 926d95e5fdc7 |
parent: | c40d2a41d7ce |
author: | Richard Westhaver <ellis@rwest.io> |
date: | Thu, 12 Sep 2024 16:48:47 -0400 |
permissions: | -rw-r--r-- |
description: | cli/multi and slime-cape fixes |
279
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
1 | ;;; std/path.lisp --- Standard Path Library |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
2 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
3 | ;; |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
4 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
5 | ;;; Code: |
291 | 6 | (in-package :std/path) |
279
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
7 | |
648
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
8 | (defun symlinkp (pathname) |
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
9 | (sb-posix:s-islnk (sb-posix:stat-mode (sb-posix:lstat pathname)))) |
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
10 | |
279
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
11 | (deftype wild-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
12 | "A pathname with wild components." |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
13 | '(and pathname (satisfies wild-pathname-p))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
14 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
15 | (deftype non-wild-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
16 | "A pathname without wild components." |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
17 | '(or directory-pathname |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
18 | (and pathname (not (satisfies wild-pathname-p))))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
19 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
20 | (deftype absolute-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
21 | '(and pathname (satisfies uiop:absolute-pathname-p))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
22 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
23 | (deftype relative-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
24 | '(and pathname (satisfies uiop:relative-pathname-p))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
25 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
26 | (deftype directory-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
27 | '(and pathname (satisfies uiop:directory-pathname-p))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
28 | |
648
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
29 | (deftype symlink-pathname () |
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
30 | '(and pathname (satisfies symlinkp))) |
926d95e5fdc7
cli/multi and slime-cape fixes
Richard Westhaver <ellis@rwest.io>
parents:
431
diff
changeset
|
31 | |
279
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
32 | (deftype absolute-directory-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
33 | '(and absolute-pathname directory-pathname)) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
34 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
35 | (deftype file-pathname () |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
36 | '(and pathname (satisfies uiop:file-pathname-p))) |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
37 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
38 | ;; logical-pathname is defined in CL. |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
39 | |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
40 | (defconstant +pathsep+ |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
41 | #+windows #\; #+unix #\: |
efc3e9ec02bf
random tune-ups, added mpd and net/util.lisp
Richard Westhaver <ellis@rwest.io>
parents:
diff
changeset
|
42 | "Path separator for this OS.") |
379 | 43 | |
44 | (defconstant +wildfile+ (make-pathname :name :wild :type :wild :version :wild)) |
|
431
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
45 | |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
46 | ;; from UIOP:ADD-PATHNAME-SUFFIX |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
47 | (defun set-pathname-suffix (path suffix &rest keys) |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
48 | (apply 'make-pathname :name (concatenate 'string (pathname-name path) suffix) |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
49 | :defaults path keys)) |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
50 | |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
51 | (defvar *tmp-suffix* "-tmp") |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
52 | |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
53 | ;; based on UIOP:TMPIZE-PATHNAME |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
54 | (defun tmpize-pathname (path) |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
55 | "Return a new pathname based on PATH and *TMP-SUFFIX* with a gensym'd integer |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
56 | appended." |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
57 | (set-pathname-suffix path (symbol-name |
c40d2a41d7ce
source concatenating std.lisp, more systems, got zstd simple working, IO work, added dat/tar
Richard Westhaver <ellis@rwest.io>
parents:
379
diff
changeset
|
58 | (gensym *tmp-suffix*)))) |