Code Monkey home page Code Monkey logo

Comments (5)

SebastianSchildt avatar SebastianSchildt commented on May 13, 2024

Okay, the root cause is a symlink that points to a non-existing file. nat can not deal with that

from nat.

danieltroger avatar danieltroger commented on May 13, 2024

"the better ls" lmao. Two rust files, not even on homebrew, one option (-f), can't list "/", written by somoene who probably spent more time on his github about section than his code.

And a big German newspaper made an article about it: https://www.heise.de/news/In-Rust-geschrieben-und-uebersichtlicher-nat-will-ls-ersetzen-4937429.html

from nat.

SebastianSchildt avatar SebastianSchildt commented on May 13, 2024

While it might technically be true, that this a few thousand lightyears behind ls in.. everything it is also true, the the account that created this has a factor 30 higher activity on Github last year than you....

Going back to-topic, I replaced calls to metadatawith symlink_metadata , which quit unintuitively does not follow symlinks, and thus doesn't fail when encountering a dangling one.

I think a better solutions is changing this

  let entries = fs::read_dir(directory)?
    .map(|res| res.map(|e| e.path()))
    .collect::<Result<Vec<_>, io::Error>>()?;

to create a Vector containing the pathes/dsiplay strings and all metadata, to get rid of the metadata calls all over the place (I think it only possible by hand, creating a mutable vector and filling it. Then it could also detect what a symlink is, and change the string to "symlinkname->symlinktarget" as in ls. but maybe there is some RUST-fu magician out there how can map the hell out of it, doing it in one go...)

Also I think using the ?operator after having read the initial directory list is a bad design choice for this tool, because it will make the program fall over whenever stumbling across some unexpected things...

from nat.

willdoescode avatar willdoescode commented on May 13, 2024

Thanks to @SebastianSchildt symlinks now work. Thread closed.

from nat.

willdoescode avatar willdoescode commented on May 13, 2024

#9

from nat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.