frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Path is a utility for working with paths

https://gitlab.com/SpyrjaGaldr/path
60•spyrja•1y ago
A recent post here got me thinking about my own personal gripes with OS path handling offerings. So I've basically spent the passed couple of days working on a little project in an attempt to rectify the situation somewhat (in the spirit of cross-platform development). It should also work pretty well with existing tools. Let me know what you think, and feel free to open an issue or a pull-request if you have any problems getting it running it on your system. Enjoy!

Github link: https://github.com/SpyrjaGaldr/path

https://simonsafar.com/2025/path_as_system_call/

https://news.ycombinator.com/item?id=43788728

Comments

vesinisa•1y ago
What can this do that standard Unix find can not do?
autobodie•1y ago
cross platform support, according to the description.
indemnity•1y ago
fd exists https://github.com/sharkdp/fd
spyrja•1y ago
Looks like it has a pretty good interface as well. It does however seem a just a bit too top-heavy (lot's of dependencies) not to mention a few more bugs than I particularly care for. But sheesh, 37K stars, it must be good for something!
blooalien•1y ago
> ... "it must be good for something!"

It's good for finding files fast, and piping the resulting file paths into other tools for further action / handling. It does what it claims to do and does it well. :)

spyrja•1y ago
I would say the default behaviour just isn't very ergonomic. Suppressing warnings for example requires piping to /dev/null (whereas `path` supresses permission warnings by default), if you want to limit the number of results you have to pipe the output to another command, getting xargs-like behaviour (obviously), or putting quotes around lines with embedded spaces, there are simply more hoops to jump through. It's much easier to type "path -sf .jpg .jpeg .png" than whatever would be required to get the `find` utility to do the same. (Or, say, finding all node_modules folders with "path -z n_m", it's just so much more satisfying.) But yes, these are mostly just syntactic-sugar kinds of issues. Aside from that (and perhaps the lack of cross-platform compatibility), I would say there is nothing inherently deficient about the `find` command. It's a work-horse which probably has more features than `path` does. But the latter really is growing on me. It is actually quite fun to use, if I may say so myself!
jimbokun•1y ago
“A more ergonomic find command” is a nice elevator pitch.
pimlottc•1y ago
From the name and description, I expected this to perform operations on file path strings, like convert relative to absolute (and vice versa), expand symlinks, convert unix paths to dos, etc. This is more like a find command.
spyrja•1y ago
I don't see why it necessarily couldn't, my only question would be if there are really many actual use cases for such things? As far as symlinks go, I suppose being able to expand them (but not following them!) might be somewhat useful. But converting to DOS paths and vice-versa? That just doesn't seem very useful. Nevermind converting to-and-fro relative and absolute paths, I can't even imagine what the point of that would be. But perhaps I'm just not seeing the forest for the trees, as they say.
qrobit•1y ago
As a rule of thumb I always make paths absolute when handling files in scripts. But then sometimes I need to copy a directory tree relative to $CWD somewhere else, so I convert them back to relative

Fish, being a great shell, provides this via `path` command[0]

[0]: https://fishshell.com/docs/current/cmds/path.html

jl6•1y ago
> for the primary purpose of helping other programs know where to find stuff

Potential footgun to make a program rely on this to locate, say, a shared library (as in one of the examples), if there’s a possibility that someone has smuggled a malware’d version of it into, say, /tmp, since it defaults to searching the root directory.

spyrja•1y ago
Kind of, but also kind of not. I mean if someone can smuggle a file into some random directory, chances are they have enough access to write directly to the "correct" folder to begin with. Personally I wouldn't execute or otherwise load any sort of executable content from a non-root directory (although certainly there are many people who wouldn't even think twice before doing such a thing). So it really just boils down to having a sane security-policy. Restrict searches with something like "path -d /usr *" and you are guaranteed not to scoop-up something that was world-writable in the first place. In fact in the example given in the README, that is precisely how that would have worked. Both /lib32 and /lib64 are owned by "root" and hence not a concern.
jl6•1y ago
Naturally every footgun is guaranteed to be safe as long as you use it right :)

I wonder if a safer default would be to start searches at the current directory rather than the root directory?

spyrja•1y ago
I did actually consider that at one point, but eventually decided against it because I felt would have meant a sacrifice in performance; first you'd do the local search, then start at the very top and recurse back down, checking every single entry against the local path to be sure that you don't do the local traversal all over again. Fortunately the code base is very clean and straight-forward, so it would be a fairly trivial excercise to just fork the repo and make those changes yourself to get that kind of behaviour.
account-5•1y ago
I've been finding nushell's `ls` with a where clause is pretty good for this. There's also the `find` command too.
spyrja•1y ago
Well I ran a bunch of tests and it turns out that the performance wasn't actually impacted very much after all. So the changes are official. I also made some other adjustments to the default behaviour; if no pattern is specified then it just matches everything. In other words, "path -f" prints every regular file in the filesystem (starting in the current one). Anyway, thanks for the suggestion, otherwise I may not gone down that (decidedly satisfying) rabbit-hole!

Hurried Announcement: Alessandro Masullo GRH

https://math216.wordpress.com/2026/11/20/hurried-announcement-alessandro-masullo-grh/
614•jasondavies•1h ago•254 comments

Levent Alpöge claims proof of the Generalized Riemann Hypothesis [pdf]

https://alpo.ge/remark.pdf
1972•iamronaldo•5h ago•1321 comments

Language Models Can Rewrite Their Own Weights

https://arxiv.org/abs/2611.21885
238•lwhsiao•3h ago•90 comments

Unforced Navier-Stokes Singularity and the Generalized Riemann Hypothesis

https://terrytao.wordpress.com/2026/11/20/unforced-euler-singularity-unforced-navier-stokes-singu...
149•archon1410•2h ago•29 comments

We promoted developers into architects without informing them

https://manidoraisamy.com/developer-to-architect.html
85•QueensGambit•1h ago•47 comments

Finite-time blow-up for the Navier–Stokes equations

https://github.com/tristanbuckmaster/navier-stokes/
186•trotro•4h ago•63 comments

Vibecoding an inference chip

https://ankitg.me/blog/vibecoding-inference-chip/
41•ankitvgupta•1h ago•11 comments

If you can't explain something in simple terms, you don't understand it (2017)

https://kottke.org/17/06/if-you-cant-explain-something-in-simple-terms-you-dont-understand-it
531•sammatilda•10h ago•267 comments

Winedroid – run Android apps without Android (WASM demo)

https://winedroid.soham.sh/demo/
16•sohzm•41m ago•2 comments

Frostbite: A new CPU architecture discovered, designed and verified by AI

https://architectlabs.com/blog/frostbite
548•shioyama•10h ago•293 comments

Signal Is Serious About Protecting Your Privacy

https://signal.org/blog/protecting-your-privacy/
368•dotcoma•10h ago•227 comments

I'm Peter Roberts, immigration attorney who does work for YC and startups. AMA

65•proberts•3h ago•89 comments

Running two PSP emulators on one Switch 2 and sharing one via GameShare

https://github.com/XITRIX/ppsspp-nx2/blob/master/SWITCH2-GAMESHARE.md
39•khalidkhair•2h ago•0 comments

Show HN: I made an audio-to-MIDI model 60x more efficient

https://kobi.music/research/dettato
188•hidude562•3d ago•35 comments

GrapheneOS claims Google is now waging war against it, could lock Pixel bootload

https://www.androidauthority.com/grapheneos-team-google-pressure-3737525/
41•jeena•49m ago•13 comments

Google Workers Tell Their Employer Not to Punish Schools That Don't Want AI

https://www.motherjones.com/politics/2026/11/google-alphabet-union-school-ai-protest-gemini-worke...
130•cdrnsf•3h ago•74 comments

Why YC Series A rounds fell off a cliff

https://jaredheyman.medium.com/on-why-yc-series-a-rounds-fell-off-a-cliff-ab523211a2f2
64•redm•2d ago•38 comments

PostgreSQL 19: A hands-on tour with runnable browser examples

https://certuvia.com/blog/postgres-19
24•petrpravda•3h ago•1 comments

LZ-RDO lands in ARM's astc-encoder

https://www.jonolick.com/home/lz-rdo-lands-in-arms-astc-encoder
5•dverlaeckt80•2d ago•0 comments

Teskooano: A 3D N-body simulator in the browser

https://teskooano.space/
8•robin_reala•2d ago•0 comments

Why there are still no non-WebKit browsers on iOS

https://blog.mozilla.org/en/mozilla/internet-policy/apple-ios-browser-engine-rules/
259•lapcat•5h ago•136 comments

The G1 Garbage Collector

https://dev.java/learn/jvm/tool/garbage-collection/g1gc-overview/
73•ejboy•3d ago•33 comments

Floppy3.5: A portable 3.5-inch floppy WiFi NAS

https://github.com/bigcrimping/floppy3.5
114•fortran77•1d ago•49 comments

The Making of Oxygene

https://jeanmicheljarre.com/aaa/the-making-of-oxygene
177•hggh•9h ago•63 comments

Anthropic shares tank after IPO as the Nasdaq erases 2026 gains

https://www.nbcnews.com/business/markets/anthropic-shares-markets-selloff-nasdaq-rcna610394
144•lelanthran•2h ago•121 comments

Lovable: Now you can explore any idea in parallel without touching what's live

https://lovable.dev/blog/introducing-drafts
28•doener•3d ago•16 comments

OpenSSL: Buffer overflow in EVP_EncodeBlock() (CVE-2026-121481, CVSS 9.8)

https://github.com/openssl/openssl/pull/33652
356•JacobHenner•18h ago•317 comments

Show HN: Fast deterministic natural language search for OpenStreetMap data

https://hippomaps.ch/?q=cafes+by+the+Limmat+100+m+from+the+lake+in+zurich#map=15.02/47.36708/8.54935
112•vihren•1d ago•32 comments

I'll never buy Framework hardware again

https://poolp.org/posts/2026-11-20/ill-never-buy-framework-hardware-again/
713•unchar1•4h ago•467 comments

What people are building, discovered through new domains

https://startups.novumsignals.com/
142•walterschnitzel•10h ago•69 comments