luxtorpeda-dev / luxtorpeda

Steam Play compatibility tool to run games using native Linux engines
GNU General Public License v2.0
717 stars 19 forks source link

$XDG_CACHE_HOME && $XDG_CACHE_HOME/luxtorpeda/ errors #44

Closed flukejones closed 4 years ago

flukejones commented 4 years ago

It appears that on some distros $XDG_CACHE_HOME isn't set, which is part one of this issue, and if it is set, then luxtorpeda/ isn't created within it.

Tracing back from this line you should probably map the errorkind to an action such as create directory, use a fallback, or at least log/describe the error since the error is passed up the chain with no context.

d10sfan commented 4 years ago

Thanks for the issue report.

I've added a fix (https://github.com/luxtorpeda-dev/luxtorpeda/commit/d5e8790e45df9aaaf9d5aca66047bdb43d0a7da7) which will be in version 23 for an issue where the luxtorpeda folder wasn't being created in the XDG_CACHE_HOME directory.

For the XDG_CACHE_HOME not being set, what's an example of a distro for testing that has this particular issue? I'm thinking I could check for that case and have a fall-back directory path of ~/.cache/luxtorpeda if that makes sense.

flukejones commented 4 years ago

fedora 33 doesn't seem to have set it. But then again that could be a fault of my bash configs. You could test for it by doing export XDG_CACHE_HOME=.

I've found out the hard way that with directories you really want to give more info, somehting like:

            .map_err(|err| {
                match err.kind() {
                    std::io::ErrorKind::NotFound => {
                               warn!(format!("Path {} is missing: {}", path, err);
                               RogError::MissingLedBrightNode((&self.bright_node).into(), err)
                    },
                    _ => RogError::Path((&self.bright_node).into(), err),
                }
            })?;

it'll help prevent a lot of bug reports like this one. Or if you want to keep .unwrap() style behaviour maybe something like:

     .expect(format!("{} may not exist", path));
ZeroPointEnergy commented 4 years ago

It is perfectly fine for XDG_CACHE_HOME not to be set. The standard says that in this case, $HOME/.cache should be used. This is something the xdg crate should already take care of. (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)

d10sfan commented 4 years ago

@flukejones Could you re-test this with the latest version and see if that fixes the issue you ran into? If you're still having issues, feel free to re-open this and I'll look further.