1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 14:30:34 +02:00

Document ‘in-vicinity’.

* module/ice-9/boot-9.scm (in-vicinity): Rename ‘vicinity’ to
‘directory’.  Add docstring.
* doc/ref/posix.texi (File System): Document it.

Suggested-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Ludovic Courtès 2025-06-18 11:29:22 +02:00
parent af0123c8b9
commit 755f703dcb
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,6 @@
;;; -*- mode: scheme; coding: utf-8; -*-
;;;; Copyright (C) 1995-2014, 2016-2024 Free Software Foundation, Inc.
;;;; Copyright (C) 1995-2014, 2016-2025 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -2144,12 +2144,15 @@ non-locally, that exit determines the continuation."
(file-name-separator-at-index? 2)
(file-name-separator-at-index? 0)))))))
(define (in-vicinity vicinity file)
(let ((tail (let ((len (string-length vicinity)))
(define (in-vicinity directory file)
"Concatenate @var{directory} and @var{file}, adding
@code{file-name-separator-string} (by default slash) in between if it is
not already present. This helps create file names."
(let ((tail (let ((len (string-length directory)))
(if (zero? len)
#f
(string-ref vicinity (- len 1))))))
(string-append vicinity
(string-ref directory (- len 1))))))
(string-append directory
(if (or (not tail) (file-name-separator? tail))
""
file-name-separator-string)