[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: get absolute path of given path
From: |
Zelphir Kaltstahl |
Subject: |
Re: get absolute path of given path |
Date: |
Mon, 7 Sep 2020 01:39:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.10.0 |
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