Giter VIP home page Giter VIP logo

fuzzle's People

Contributors

psykopear avatar synasius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fuzzle's Issues

Panics when a data directory has no applications subdirectory.

When fuzzle builds its cache based on .desktop files, it assumes that each data directory listed by xdg has an applications subdirectory.

This is not always the case and when it's not fuzzle panics. This is the code responsible for the panic.

pub fn build_cache() -> Vec<SearchResult> {
    let mut results: Vec<SearchResult> = Vec::new();
    // Build SearchResults for all desktop files we can find
    for mut data_dir in search_dirs() {
        data_dir.push("applications");    // <--- here you push applications
        results.append(
            &mut fs::read_dir(data_dir)
                .expect("Can't find data dir")
                .filter_map(|path| searchresult_from_desktopentry(&path.unwrap().path()))
                .collect(),
        );
    }
    // ...
}

After you append applications to each data dir path I would check if the resulting directory exists before you try to read its entries.

Panics because of hard-coded paths when fuzzle search for binaries

fuzzle panics because it search on the hard-coded path /home/docler/...

May I suggest to use the content of the PATH environment variable to get a list of binary paths?

Anyway here you should remove the expect and fail gracefully

    for dir in &["/usr/bin", "/usr/local/bin", "/home/docler/.local/bin/"] {
        results.append(
            &mut fs::read_dir(dir)
                .expect("Can't find /usr/bin")
                .filter_map(|path| searchresult_from_bin(&path.unwrap().path()))
                .collect(),
        );
    }

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.