unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: Matt Wette <matt.wette@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: get absolute path of given path
Date: Mon, 7 Sep 2020 01:39:09 +0200	[thread overview]
Message-ID: <b2603ffb-f368-5ff7-84c3-6b5cdc3b31bb@posteo.de> (raw)
In-Reply-To: <d86137d8-3881-dd92-a27d-f505b2ccff57@gmail.com>

Hi Matt!

On 06.09.20 17:20, Matt Wette wrote:
>
> 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


This I definitely did not know and it seems like it would fit perfectly
for my use-case. Thank you!

Regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl




      reply	other threads:[~2020-09-06 23:39 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
2020-09-06 23:39   ` Zelphir Kaltstahl [this message]

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=b2603ffb-f368-5ff7-84c3-6b5cdc3b31bb@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=guile-user@gnu.org \
    --cc=matt.wette@gmail.com \
    /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).