Remove failure package (#166)

* Remove dependency on failure

* Update flatpak cargo-lock

* Update cargo version

* Update release manifest
This commit is contained in:
Philip Kristoffersen
2022-06-07 11:53:15 +02:00
committed by GitHub
parent ded52665fe
commit 0385dfb40b
9 changed files with 48 additions and 296 deletions
Generated
+1 -81
View File
@@ -18,15 +18,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a13739d7177fbd22bb0ed28badfff9f372f8bef46c863db4e1c6248f6b223b6e"
[[package]]
name = "addr2line"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
@@ -107,21 +98,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61"
dependencies = [
"addr2line",
"cc",
"cfg-if 1.0.0",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.13.0"
@@ -148,7 +124,7 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "boilr"
version = "1.3.15"
version = "1.3.16"
dependencies = [
"base64",
"chrono",
@@ -157,7 +133,6 @@ dependencies = [
"dashmap",
"eframe",
"egui",
"failure",
"flate2",
"futures",
"image",
@@ -757,28 +732,6 @@ dependencies = [
"threadpool",
]
[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [
"backtrace",
"failure_derive",
]
[[package]]
name = "failure_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]]
name = "fastrand"
version = "1.7.0"
@@ -987,12 +940,6 @@ dependencies = [
"weezl",
]
[[package]]
name = "gimli"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "gl_generator"
version = "0.14.0"
@@ -1775,15 +1722,6 @@ dependencies = [
"objc",
]
[[package]]
name = "object"
version = "0.28.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.10.0"
@@ -2151,12 +2089,6 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2"
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rusty-leveldb"
version = "0.3.6"
@@ -2475,18 +2407,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
[[package]]
name = "sysinfo"
version = "0.23.12"
+2 -3
View File
@@ -1,14 +1,13 @@
[package]
edition = "2021"
name = "boilr"
version = "1.3.15"
version = "1.3.16"
[dependencies]
base64 = "^0.13.0"
chrono = "^0.4.19"
config = "^0.11.0"
copypasta = "0.7.1"
failure = "^0.1.8"
copypasta = "^0.7.1"
flate2 = "^1.0.23"
is_executable = "^1.0.1"
nom = "^7.1.1"
-104
View File
@@ -25,19 +25,6 @@
"dest": "cargo/vendor/ab_glyph_rasterizer-0.1.5",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/addr2line/addr2line-0.17.0.crate",
"sha256": "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b",
"dest": "cargo/vendor/addr2line-0.17.0"
},
{
"type": "inline",
"contents": "{\"package\": \"b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b\", \"files\": {}}",
"dest": "cargo/vendor/addr2line-0.17.0",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -168,19 +155,6 @@
"dest": "cargo/vendor/autocfg-1.1.0",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/backtrace/backtrace-0.3.65.crate",
"sha256": "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61",
"dest": "cargo/vendor/backtrace-0.3.65"
},
{
"type": "inline",
"contents": "{\"package\": \"11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61\", \"files\": {}}",
"dest": "cargo/vendor/backtrace-0.3.65",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -974,32 +948,6 @@
"dest": "cargo/vendor/exr-1.4.2",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/failure/failure-0.1.8.crate",
"sha256": "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86",
"dest": "cargo/vendor/failure-0.1.8"
},
{
"type": "inline",
"contents": "{\"package\": \"d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86\", \"files\": {}}",
"dest": "cargo/vendor/failure-0.1.8",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/failure_derive/failure_derive-0.1.8.crate",
"sha256": "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4",
"dest": "cargo/vendor/failure_derive-0.1.8"
},
{
"type": "inline",
"contents": "{\"package\": \"aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4\", \"files\": {}}",
"dest": "cargo/vendor/failure_derive-0.1.8",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -1273,19 +1221,6 @@
"dest": "cargo/vendor/gif-0.11.3",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/gimli/gimli-0.26.1.crate",
"sha256": "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4",
"dest": "cargo/vendor/gimli-0.26.1"
},
{
"type": "inline",
"contents": "{\"package\": \"78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4\", \"files\": {}}",
"dest": "cargo/vendor/gimli-0.26.1",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -2313,19 +2248,6 @@
"dest": "cargo/vendor/objc_id-0.1.1",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/object/object-0.28.4.crate",
"sha256": "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424",
"dest": "cargo/vendor/object-0.28.4"
},
{
"type": "inline",
"contents": "{\"package\": \"e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424\", \"files\": {}}",
"dest": "cargo/vendor/object-0.28.4",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -2794,19 +2716,6 @@
"dest": "cargo/vendor/rust-ini-0.13.0",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/rustc-demangle/rustc-demangle-0.1.21.crate",
"sha256": "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342",
"dest": "cargo/vendor/rustc-demangle-0.1.21"
},
{
"type": "inline",
"contents": "{\"package\": \"7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342\", \"files\": {}}",
"dest": "cargo/vendor/rustc-demangle-0.1.21",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -3249,19 +3158,6 @@
"dest": "cargo/vendor/syn-1.0.94",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
"url": "https://static.crates.io/crates/synstructure/synstructure-0.12.6.crate",
"sha256": "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f",
"dest": "cargo/vendor/synstructure-0.12.6"
},
{
"type": "inline",
"contents": "{\"package\": \"f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f\", \"files\": {}}",
"dest": "cargo/vendor/synstructure-0.12.6",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "archive",
"archive-type": "tar-gzip",
@@ -25,6 +25,16 @@ https://hughsie.github.io/oars/index.html
-->
<content_rating type="oars-1.1" />
<releases>
<release version="1.3.16" date="2022-06-07">
<description>
<ul>
<li>Removed dependency on unsafe package failure</li>
</ul>
</description>
</release>
<release version="1.3.14" date="2022-05-30">
<description>
<ul>
+3 -6
View File
@@ -1,9 +1,6 @@
use crate::platform::{Platform, SettingsValidity};
use super::{
get_egs_manifests, get_manifests::EpicGamesManifestsError, EpicGamesLauncherSettings,
ManifestItem,
};
use super::{get_egs_manifests, EpicGamesLauncherSettings, ManifestItem};
pub struct EpicPlatform {
settings: EpicGamesLauncherSettings,
@@ -17,7 +14,7 @@ impl EpicPlatform {
}
}
impl Platform<ManifestItem, EpicGamesManifestsError> for EpicPlatform {
impl Platform<ManifestItem, String> for EpicPlatform {
fn enabled(&self) -> bool {
self.settings.enabled
}
@@ -26,7 +23,7 @@ impl Platform<ManifestItem, EpicGamesManifestsError> for EpicPlatform {
"EGS"
}
fn get_shortcuts(&self) -> Result<Vec<ManifestItem>, EpicGamesManifestsError> {
fn get_shortcuts(&self) -> Result<Vec<ManifestItem>, String> {
get_egs_manifests(&self.settings)
}
+6 -20
View File
@@ -4,23 +4,9 @@ use std::fs::{DirEntry, File};
use std::io::BufReader;
use std::path::Path;
use failure::*;
#[derive(Debug, Fail)]
pub enum EpicGamesManifestsError {
#[fail(display = "EpicGamesLauncher not found")]
NotFound,
#[fail(
display = "Could not read EpicGamesLauncher manifest directory at {} error: {}",
path, error
)]
ReadDirError { path: String, error: std::io::Error },
}
pub(crate) fn get_egs_manifests(
settings: &EpicGamesLauncherSettings,
) -> Result<Vec<ManifestItem>, EpicGamesManifestsError> {
) -> Result<Vec<ManifestItem>, String> {
let locations = crate::egs::get_locations();
match locations {
Some(locations) => {
@@ -83,13 +69,13 @@ pub(crate) fn get_egs_manifests(
}
Ok(manifests)
}
Err(err) => Err(EpicGamesManifestsError::ReadDirError {
error: err,
path: manifest_dir_path.to_string_lossy().to_string(),
}),
Err(err) => Err(format!(
"Could not read dir at: {:?} error: {:?}",
manifest_dir_path, err
)),
}
}
None => Err(EpicGamesManifestsError::NotFound),
None => Err("Manifests not found".to_string()),
}
}
+10 -35
View File
@@ -1,4 +1,3 @@
use failure::*;
use std::path::{Path, PathBuf};
use crate::{gog::gog_config::GogConfig, platform::Platform};
@@ -15,7 +14,7 @@ pub struct GogPlatform {
pub fn get_shortcuts_from_config(
_wine_c_drive: Option<String>,
config_path: PathBuf,
) -> Result<Vec<GogShortcut>, GogErrors> {
) -> Result<Vec<GogShortcut>, String> {
let install_locations = get_install_locations(config_path)?;
#[cfg(target_family = "unix")]
let install_locations = if let Some(wine_c_drive) = &_wine_c_drive {
@@ -138,7 +137,7 @@ fn get_games_from_game_folders(game_folders: Vec<PathBuf>) -> Vec<(GogGame, Path
games
}
impl Platform<GogShortcut, GogErrors> for GogPlatform {
impl Platform<GogShortcut, String> for GogPlatform {
fn enabled(&self) -> bool {
self.settings.enabled
}
@@ -152,7 +151,7 @@ impl Platform<GogShortcut, GogErrors> for GogPlatform {
self.settings.create_symlinks
}
fn get_shortcuts(&self) -> Result<Vec<GogShortcut>, GogErrors> {
fn get_shortcuts(&self) -> Result<Vec<GogShortcut>, String> {
let gog_location = self
.settings
.location
@@ -160,11 +159,11 @@ impl Platform<GogShortcut, GogErrors> for GogPlatform {
.map(|location| Path::new(&location).to_path_buf())
.unwrap_or_else(default_location);
if !gog_location.exists() {
return Err(GogErrors::PathNotFound { path: gog_location });
return Err(format!("Could not find path: {:?}", gog_location));
}
let config_path = gog_location.join("config.json");
if !config_path.exists() {
return Err(GogErrors::ConfigFileNotFound { path: config_path });
return Err(format!("Config file not found: {:?}", config_path));
}
get_shortcuts_from_config(self.settings.wine_c_drive.clone(), config_path)
}
@@ -203,17 +202,11 @@ fn fix_paths(wine_c_drive: &str, paths: Vec<String>) -> Vec<String> {
.collect()
}
fn get_install_locations(path: PathBuf) -> Result<Vec<String>, GogErrors> {
let data_res =
std::fs::read_to_string(&path).map_err(|e| GogErrors::ConfigFileCouldNotBeRead {
path: path.clone(),
error: format!("{}", e),
})?;
let config: GogConfig =
serde_json::from_str(&data_res).map_err(|e| GogErrors::ConfigFileCouldNotBeRead {
path,
error: format!("{}", e),
})?;
fn get_install_locations(path: PathBuf) -> Result<Vec<String>, String> {
let data_res = std::fs::read_to_string(&path)
.map_err(|e| format!("Config file not read {:?} , error: {:?} ", path.clone(), e))?;
let config: GogConfig = serde_json::from_str(&data_res)
.map_err(|e| format!("Config file not read {:?} , error: {:?} ", path.clone(), e))?;
let path_vec = match config.library_path {
Some(path) => vec![path],
None => vec![],
@@ -234,21 +227,3 @@ pub fn default_location() -> PathBuf {
Path::new(&home).join("Games/gog-galaxy/drive_c/ProgramData/GOG.com/Galaxy")
}
}
#[derive(Debug, Fail)]
pub enum GogErrors {
#[fail(
display = "Gog path: {:?} could not be found. Try to specify a different path for Gog.",
path
)]
PathNotFound { path: PathBuf },
#[fail(display = "Gog config file not found at path: {:?}", path)]
ConfigFileNotFound { path: PathBuf },
#[fail(
display = "Gog config file at path: {:?} could not be red {}",
path, error
)]
ConfigFileCouldNotBeRead { path: PathBuf, error: String },
}
+8 -22
View File
@@ -2,7 +2,6 @@ use super::butler_db_parser::*;
use super::receipt::Receipt;
use super::{ItchGame, ItchSettings};
use crate::platform::{Platform, SettingsValidity};
use failure::*;
use flate2::read::GzDecoder;
use is_executable::IsExecutable;
use std::collections::HashSet;
@@ -19,7 +18,7 @@ impl ItchPlatform {
}
}
impl Platform<ItchGame, ItchErrors> for ItchPlatform {
impl Platform<ItchGame, String> for ItchPlatform {
fn enabled(&self) -> bool {
self.settings.enabled
}
@@ -28,25 +27,24 @@ impl Platform<ItchGame, ItchErrors> for ItchPlatform {
"Itch"
}
fn get_shortcuts(&self) -> Result<Vec<ItchGame>, ItchErrors> {
fn get_shortcuts(&self) -> Result<Vec<ItchGame>, String> {
let itch_location = self.settings.location.clone();
let itch_location = itch_location.unwrap_or_else(get_default_location);
let itch_db_location = Path::new(&itch_location).join("db").join("butler.db-wal");
if !itch_db_location.exists() {
return Err(ItchErrors::PathNotFound {
path: itch_db_location.to_str().unwrap().to_string(),
});
return Err(format!("Path not found: {:?}", itch_db_location.to_str()));
}
let shortcut_bytes = std::fs::read(&itch_db_location).unwrap();
let paths = match parse_butler_db(&shortcut_bytes) {
Ok((_, shortcuts)) => Ok(shortcuts),
Err(e) => Err(ItchErrors::ParseError {
error: e.to_string(),
path: itch_db_location.to_str().unwrap().to_string(),
}),
Err(e) => Err(format!(
"Could not parse path: {:?} , error: {:?}",
itch_db_location.to_str(),
e
)),
}?;
//This is done to paths dedupe
@@ -129,15 +127,3 @@ pub fn get_default_location() -> String {
.to_string()
//C:\Users\phili\AppData\Local\itch
}
#[derive(Debug, Fail)]
pub enum ItchErrors {
#[fail(
display = "Itch path: {} could not be found. Try to specify a different path for the Itch.",
path
)]
PathNotFound { path: String },
#[fail(display = "Could not parse Itch db at {} error: {}", path, error)]
ParseError { path: String, error: String },
}
+8 -25
View File
@@ -1,5 +1,4 @@
use crate::platform::{Platform, SettingsValidity};
use failure::*;
use nom::bytes::complete::take_until;
use std::{
fs::DirEntry,
@@ -12,7 +11,7 @@ pub struct OriginPlatform {
pub settings: OriginSettings,
}
impl Platform<OriginGame, OriginErrors> for OriginPlatform {
impl Platform<OriginGame, String> for OriginPlatform {
fn enabled(&self) -> bool {
self.settings.enabled
}
@@ -26,21 +25,20 @@ impl Platform<OriginGame, OriginErrors> for OriginPlatform {
false
}
fn get_shortcuts(&self) -> Result<Vec<OriginGame>, OriginErrors> {
fn get_shortcuts(&self) -> Result<Vec<OriginGame>, String> {
let origin_folders = get_default_locations();
if origin_folders.is_none() {
return Err(OriginErrors::PathNotFound {
path: "Default path".to_string(),
});
return Err(String::from("Default path not found"));
}
let origin_folders = origin_folders.unwrap();
let origin_folder = origin_folders.local_content_path;
let origin_exe = origin_folders.exe_path;
let game_folders = origin_folder.join("LocalContent").read_dir().map_err(|e| {
OriginErrors::CouldNotReadGameDir {
path: origin_folder.join("LocalContent"),
error: format!("{:?}", e),
}
format!(
"Could not read game dir: {} , error: {:?}",
origin_folder.join("LocalContent").to_string_lossy(),
e
)
})?;
let games = game_folders
.filter_map(|folder| folder.ok())
@@ -202,18 +200,3 @@ fn get_exe_path() -> Option<PathBuf> {
}
None
}
#[derive(Debug, Fail)]
pub enum OriginErrors {
#[fail(
display = "Origin path: {} could not be found. Try to specify a different path for Origin.",
path
)]
PathNotFound { path: String },
#[fail(
display = "Could not read Origin directory: {:?}. Error: {}",
path, error
)]
CouldNotReadGameDir { path: PathBuf, error: String },
}