Skip to content

Commit

Permalink
Merge pull request #12 from talis-fb/develop
Browse files Browse the repository at this point in the history
Hotfix bug opening without file of variables already saved
  • Loading branch information
talis-fb committed Apr 12, 2023
2 parents f811c97 + fb0c974 commit 28f4847
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "treq"
authors = [ "Talis-Fb" ]
version = "0.3.0"
version = "0.3.1"
edition = "2021"
license = "GPL-3.0"
description = "A Client to make HTTP requests for Vim/Terminal Users"
Expand Down
9 changes: 7 additions & 2 deletions src/config/configurations/global_variables_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;

use super::{Configuration, ConfigurationEditable};

static NAME_FILE: &str = "global_variables";
static NAME_FILE: &str = "global_variables.json";

#[derive(Clone)]
pub struct GlobalVariablesFiles {
Expand All @@ -15,7 +15,12 @@ impl Configuration<(), DataFile, HashMap<String, String>> for GlobalVariablesFil
DataFile::setup()?;

let path = DataFile::get_parent_path().join(NAME_FILE);
let file_variables = DataFile::from_path(path);
let mut file_variables = DataFile::from_path(path);

let content = file_variables.get_content();
if content.is_err() {
file_variables.save_content("{}".to_string())?;
}

Ok(Self { file_variables })
}
Expand Down
10 changes: 0 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
// Configurations and Setup of necessary folders
ConfigManager::setup_env().expect("Error creating folders .local/share/treq. If error persist create it with mkdir $HOME/.local/share/treq");
let config_manager = ConfigManager::init();
let already_opened_app_once = config_manager
.saved_requests
.lock()
.unwrap()
.exist_already_some_file();

// Init of Data Stores
let mut data_store = MainStore::init(config_manager);
Expand Down Expand Up @@ -99,11 +94,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
app.set_data_store(data_store);
app.set_renderer(action_queue_sender);

if !already_opened_app_once {
command_handler.add(Commands::open_welcome_screen());
command_handler.run(&mut app).unwrap();
}

while !app.is_finished {
view.render(app.get_data_store());

Expand Down

0 comments on commit 28f4847

Please sign in to comment.