Skip to content

Commit

Permalink
Remove unnecessary PathBuf usage in set_openai_api_key.rs (#139)
Browse files Browse the repository at this point in the history
- Changed the way the configuration path is constructed by directly using the home directory.
- Removed the import of PathBuf as it is no longer needed, simplifying the code.
  • Loading branch information
takanotume24 authored Dec 19, 2024
1 parent 9fad40d commit 74456d6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src-tauri/src/set_openai_api_key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::config::Config;
use std::fs;
use std::path::PathBuf;

#[tauri::command]
pub async fn set_openai_api_key(api_key: String) -> Result<(), String> {
Expand All @@ -13,7 +12,7 @@ pub async fn set_openai_api_key(api_key: String) -> Result<(), String> {
let home_dir = dirs::home_dir()
.ok_or_else(|| "Failed to get home directory".to_string())?;

let mut config_path = PathBuf::from(home_dir);
let mut config_path = home_dir;
config_path.push(".cuuri/config.toml");

// Attempt to load the configuration from the file
Expand Down

0 comments on commit 74456d6

Please sign in to comment.