unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* feature request: realpath
@ 2017-06-03 17:20 j kalbhenn
  2017-06-04 20:00 ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: j kalbhenn @ 2017-06-03 17:20 UTC (permalink / raw)
  To: guile-devel

guile does not offer "realpath", which is part of the posix standard as far as i can tell. http://pubs.opengroup.org/onlinepubs/9699919799/

i think this would be useful to have and it does not seem trivial to re-implement in scheme.

one of my use cases would be finding the first matching load path for a full path which might not contain any of the load paths exactly.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature request: realpath
  2017-06-03 17:20 feature request: realpath j kalbhenn
@ 2017-06-04 20:00 ` Alex Kost
  2017-06-04 21:36   ` j kalbhenn
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2017-06-04 20:00 UTC (permalink / raw)
  To: j kalbhenn; +Cc: guile-devel

j kalbhenn (2017-06-03 17:20 +0000) wrote:

> guile does not offer "realpath", which is part of the posix standard as
> far as i can tell. http://pubs.opengroup.org/onlinepubs/9699919799/

Guile provides "readlink".  Isn't it the thing you need?

-- 
Alex



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature request: realpath
  2017-06-04 20:00 ` Alex Kost
@ 2017-06-04 21:36   ` j kalbhenn
  2017-06-05 19:47     ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: j kalbhenn @ 2017-06-04 21:36 UTC (permalink / raw)
  To: Alex Kost; +Cc: guile-devel

> Guile provides "readlink".  Isn't it the thing you need?

no, i am afraid not. readlink returns the target of a symbolic link. realpath resolves all directory references like ".." and "." and all symbolic links in a path and returns a path that does not include those things.

i have now implemented my own version of realpath in scheme (could have used the ffi probably), but since it is a standard lib function in C and guile offers many other posix functions, i thought it would be well suited for inclusion.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature request: realpath
  2017-06-04 21:36   ` j kalbhenn
@ 2017-06-05 19:47     ` Alex Kost
  2017-06-06 13:33       ` J. Kalbhenn
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2017-06-05 19:47 UTC (permalink / raw)
  To: j kalbhenn; +Cc: guile-devel

j kalbhenn (2017-06-04 21:36 +0000) wrote:

>> Guile provides "readlink".  Isn't it the thing you need?
>
> no, i am afraid not. readlink returns the target of a symbolic
> link. realpath resolves all directory references like ".." and "." and
> all symbolic links in a path and returns a path that does not include
> those things.

Oh, I see.  There is 'canonicalize-path' that can handle ".." and "."

> i have now implemented my own version of realpath in scheme (could have
> used the ffi probably), but since it is a standard lib function in C and
> guile offers many other posix functions, i thought it would be well
> suited for inclusion.

Yeah, I agree, I also expected to see 'realpath' in Guile :-)

-- 
Alex



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature request: realpath
  2017-06-05 19:47     ` Alex Kost
@ 2017-06-06 13:33       ` J. Kalbhenn
  2017-06-06 17:48         ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: J. Kalbhenn @ 2017-06-06 13:33 UTC (permalink / raw)
  To: Alex Kost; +Cc: guile-devel

> Oh, I see.  There is 'canonicalize-path' that can handle ".." and "."

but not in guile, or is it? i have not found it in the manual. maybe it 
is only in racket.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: feature request: realpath
  2017-06-06 13:33       ` J. Kalbhenn
@ 2017-06-06 17:48         ` Alex Kost
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Kost @ 2017-06-06 17:48 UTC (permalink / raw)
  To: J. Kalbhenn; +Cc: guile-devel

J. Kalbhenn (2017-06-06 13:33 +0000) wrote:

>> Oh, I see.  There is 'canonicalize-path' that can handle ".." and "."
>
> but not in guile, or is it? i have not found it in the manual. maybe it
> is only in racket.

It is in Guile as you can check in the guile REPL.  It's just not
documented.

-- 
Alex



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-06 17:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-03 17:20 feature request: realpath j kalbhenn
2017-06-04 20:00 ` Alex Kost
2017-06-04 21:36   ` j kalbhenn
2017-06-05 19:47     ` Alex Kost
2017-06-06 13:33       ` J. Kalbhenn
2017-06-06 17:48         ` Alex Kost

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).