From 8f46888688045908167c325c5032b0a7279aa35b Mon Sep 17 00:00:00 2001 From: Luke Harding Date: Sun, 28 Apr 2024 00:46:37 -0400 Subject: [PATCH] Remove install_check --- src/install_check.rs | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/install_check.rs diff --git a/src/install_check.rs b/src/install_check.rs deleted file mode 100644 index 6741cc8..0000000 --- a/src/install_check.rs +++ /dev/null @@ -1,38 +0,0 @@ -/* - Rust Arch Linux Updater - Copyright (C) 2024 Luke Harding - This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ - -/* - install_check.rs - This module allows for checking if any file is present on the filesystem -*/ - -use std::fmt; -use std::fmt::Formatter; -use std::path::Path; - -#[derive(Debug, Clone)] -pub struct NotInstalledError { - file_name: String, -} - -impl fmt::Display for NotInstalledError { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "{} not found.", self.file_name) - } -} - -pub fn run(path: impl Into) -> Result<(), NotInstalledError> { - let path = path.into(); - let exists = Path::new(&path).exists(); - - if exists { - Ok(()) - } else { - Err(NotInstalledError { file_name: path }) - } -}