From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: get absolute path of given path
Date: Sun, 6 Sep 2020 08:20:49 -0700 [thread overview]
Message-ID: <d86137d8-3881-dd92-a27d-f505b2ccff57@gmail.com> (raw)
In-Reply-To: <53fcdc7a-5c55-3f11-5812-a02729a12295@posteo.de>
On 9/6/20 8:04 AM, Zelphir Kaltstahl wrote:
> Hi Guile Users!
>
> In my explorations into making examples for web development, I came
> across the question of how to get an absolute path from any given path.
> This is useful for example when checking, whether a path points to
> something inside a static assets directory, or perhaps sneakily tries to
> escape that and access things it should not.
>
> I found in Guile's manual the function (canonicalize-path path).
> However, this function has one problem, which makes it not sufficient on
> its own: It raises an exception, when a path given points to something
> that does not exist. I would like to have a function, that gives me the
> absolute path of any path I give as argument, not only for existing
> paths. So i went ahead and wrote the following code
> (https://notabug.org/ZelphirKaltstahl/guile-examples/src/14a76a6aee18a900ac9b9de2b79ede239f8cf9f0/file-system/path-handling.scm):
>
Maybe you would like false-if-exception.
https://www.gnu.org/software/guile/manual/html_node/Error-Reporting.html
next prev parent reply other threads:[~2020-09-06 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-06 15:04 get absolute path of given path Zelphir Kaltstahl
2020-09-06 15:20 ` Matt Wette [this message]
2020-09-06 23:39 ` Zelphir Kaltstahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d86137d8-3881-dd92-a27d-f505b2ccff57@gmail.com \
--to=matt.wette@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).