Compare commits
2 commits
08103a08fc
...
0a4a401953
Author | SHA1 | Date | |
---|---|---|---|
snow flurry | 0a4a401953 | ||
snow flurry | 3e6d025b74 |
|
@ -149,6 +149,7 @@ fn get_shortcuts(path: PathBuf) -> Result<Vec<NonSteamGame>, String> {
|
|||
let vec: Result<Vec<NonSteamGame>, String> = vdf_map["shortcuts"]
|
||||
.clone()
|
||||
.into_vec()
|
||||
.map_or_else(|| Err("Malformed shortcuts.vdf".to_owned()), Ok)?
|
||||
.into_iter()
|
||||
.map(|x| {
|
||||
if let vdf::VdfValue::Dict(dict) = x {
|
||||
|
|
|
@ -21,6 +21,7 @@ impl HeuristicError {
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets the Steam local directory
|
||||
pub fn get_steamdir() -> Result<PathBuf, Box<dyn std::error::Error>> {
|
||||
let mut dir = dirs::data_local_dir().unwrap_or_else(|| {
|
||||
let mut dir = dirs::home_dir().unwrap();
|
||||
|
|
|
@ -28,12 +28,12 @@ pub enum VdfValue {
|
|||
}
|
||||
|
||||
impl VdfValue {
|
||||
pub fn into_vec(self) -> Vec<VdfValue> {
|
||||
pub fn into_vec(self) -> Option<Vec<VdfValue>> {
|
||||
if let VdfValue::Dict(dict) = self {
|
||||
// lazily assuming this is an array of strings
|
||||
dict.into_values().collect()
|
||||
Some(dict.into_values().collect())
|
||||
} else {
|
||||
panic!("Not a Dict! (maybe this should be less brutal of error mgmt!)");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue