Re: how to expand ~ in a filepath
Tristan Cacqueray via Haskell-Cafe <[email protected]> Mon, 21 Jul 2025 09:55:57 +0200
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <87o6tec702.tristanC@fedora> |
Hello, unfortunately there is no "expandHomePath" or "realpath" helpers in the standard libraries. Searching for "FilePath -> IO FilePath" in hoogle shows an implementation in the hledger project: https://hackage-content.haskell.org/package/hledger-lib-1.43.2/docs/Hledger-Utils-IO.html#v:expandHomePath … which check if the path begins with "~/", and replace that with the output of "getHomeDirectory" -Tristan On Mon, Jul 21, 2025 at 07:19 PICCA Frederic-Emmanuel wrote: > Hello, I am trying to open and read the content of this kind of filepath. > > ~/debian/changelog > > So is there a prefered way to expand the ~ into the real $HOME. > > thanks for your help > > Frédéric > > > Classification de confidentialité SOLEIL > > Ce message et ses pièces jointes peuvent contenir des informations soumises à des règles de diffusion : > > * P (Public) : Diffusion libre y compris à l'extérieur de SOLEIL. > * I (Interne) : Diffusion libre au sein de SOLEIL, ne doit pas être communiqué à l’extérieur sauf mention spécifique. > * C (Confidentiel) : Diffusion restreinte aux personnes autorisées, internes ou externes. Le partage nécessite l'accord de la hiérarchie. > * S (Sensible) : Accès restreint aux seuls destinataires. Partage non autorisé. > > Les informations contenues dans cet e-mail sont la propriété de SOLEIL. Si vous n'êtes pas le destinataire prévu, merci de nous en notifier et de ne pas utiliser, copier ou distribuer les informations qu'il contient. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
signature.asc
(application/pgp-signature, 515 B)
-----BEGIN PGP SIGNATURE----- iQFIBAEBCgAyFiEE6xA96LXmnmMcb/F5IrmgXJJcxdgFAmh98o0UHHRkZWNhY3F1 QHJlZGhhdC5jb20ACgkQIrmgXJJcxdgs0Af+JQg0BrQwWiHlJcSgFOA3tfoUy1PZ SGi4J2c7PxcDJ0UUTFdNX4KDaOc6YTYnEdYI2pU1hKK+AJydaJWWJAaZeplBzVM0 5s6MPKFkEgu3G/UX//irOSInTqjSM4jeO3bv3fk3VbKmVrnQXcvVbFZ28OjFLSX8 KBcJpVh0rXTD2/PzpzfGcCdx3Uok/Qw5P7QGZm9iezkZ8cxagT62OrWNvz1GyP2Z c5FknxvzO2V8sjFlp/VphYaKz1fBpFVjAG6mxZLmrQlYM3I32RQbuVtt6avr0Jsz WWD3PT2OgfT4IQWoqtaRQuTAPPpCY73iQR1st7LAwSl04uBgd7g/RDSVKg== =ugmY -----END PGP SIGNATURE-----