Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
fix file is not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
TOwInOK committed May 1, 2024
1 parent 8c73ec2 commit f3282cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ async fn main() -> Result<()> {
pretty_env_logger::formatted_builder()
.filter_level(log::LevelFilter::Info)
.init();
// Lock::default().save().await?;
let mpb = Arc::new(Mutex::new(MultiProgress::new()));
let pb = mpb.lock().await.add(ProgressBar::new_spinner());
pb.finish_with_message("Init Minecraft Addon Controller");

let lock = Arc::new(Mutex::new(Lock::load().await.unwrap_or_default()));
let settings = Settings::load().await?;
// let a = Additions::new(Some("GitHub.link".to_string()), Some("GitHub.key".to_string()));
Expand Down
7 changes: 1 addition & 6 deletions src/tr/save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ pub trait Save {
{
async move {
{
let os_path = Path::new(Self::PATH);
// Проверить путь на исправность
if !os_path.exists() {
return not_found_path!(Self::PATH);
}
// Сериализуем в понятный человеку томл
let toml_content = toml::to_string_pretty(&self)?;

// Откроем для записи
let mut file = File::create(os_path).await?;
let mut file = File::create(Self::PATH).await?;

// Запишем файл
file.write_all(toml_content.as_bytes()).await?;
Expand Down

0 comments on commit f3282cb

Please sign in to comment.