wml::sup::path(3)

πŸ“¦
version 2.32.0 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing

πŸ’– wml::sup::path πŸ’–

ok so bestie, welcome to wml::sup::path(3) β€” the EN Tools era, EN Tools vibes only ✨ this is the page where we make filesystem paths make sense, no cap.


✨ NAME ✨

wml::sup::path β€” Filesystem Path Manipulation πŸ›£οΈ (yes literally, that's the whole job, and she eats every time)


πŸŽ€ SYNOPSIS πŸŽ€

first you gotta pull her in:

#use wml::sup::path

then it's giving three little one-liners that do the absolute most:

<: $relpath = relpath($from, $to); :>
<: $path    = canonpath($path);    :>
<: $url     = canonurl($url);      :>

look at that alignment πŸ’… symmetrical, iconic, the moment.


πŸ¦‹ DESCRIPTION πŸ¦‹

so this include file ships the Perl functions relpath, canonpath and canonurl 🫢 and what they do is calculate relative and canonical paths/urls. that's it, that's the whole personality, and honestly? obsessed.

like, for example β€” and this is the example, not me freestyling β€” the relative path from /foo/path/bar/quux to /foo/path/foobar is calculated to ../../foobar 🌸 see how she climbed out of the quux folder, backed up twice, and landed right on foobar? main character energy fr fr.

and the canonical path of ./foo/./bar/../quux// is foo/quux/ πŸ’– all those ./s and ../s and the double slash got cleaned up and now it's just... neat. canonpath said "not on my watch" and she ate. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

this whole thing was written by the one and only:

  • Ralf S. Engelschall ⭐
  • rse@engelschall.com
  • www.engelschall.com

put some respect on the name, legend behaviour tbh πŸ™Œ


🌈 REQUIRES 🌈

what she needs to run her little show:

  • Internal: P1, P3
  • External: -- (nothing bestie, she's self-sufficient, highkey independent πŸ’…)

🧚 SEE ALSO 🧚

if you wanna go deeper (and you should, iykyk):


🚨 quick vibe check: all those paths and urls up there are literal β€” don't go rewriting them in your head, copy them exactly or you WILL be lost in the directory tree like it's a corn maze 😭

ok that's the whole page!! EN Tools, version stamped 2020-11-29, and the manual is wml::sup::path(3) in section 3 πŸŽ€ mwah, go manipulate some paths bestie, you got this βœ¨πŸ’–πŸ¦‹

πŸ“¦ where this page comes from