mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 16:19:48 +00:00
Handle the case where the path is already absolute
This commit is contained in:
parent
ef5ff66939
commit
dc00983539
@ -78,6 +78,13 @@ pub fn init_logging() {
|
|||||||
|
|
||||||
fn convert_log_path_to_string(log_path: &FileSpec) -> String {
|
fn convert_log_path_to_string(log_path: &FileSpec) -> String {
|
||||||
let log_path = log_path.as_pathbuf(None);
|
let log_path = log_path.as_pathbuf(None);
|
||||||
|
|
||||||
|
// Case: The path is already absolute:
|
||||||
|
if log_path.is_absolute() {
|
||||||
|
return log_path.to_str().unwrap().to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Case: The path is relative. Let's try to convert it to an absolute path:
|
||||||
match log_path.canonicalize() {
|
match log_path.canonicalize() {
|
||||||
// Case: The path exists:
|
// Case: The path exists:
|
||||||
Ok(log_path) => log_path.to_str().unwrap().to_string(),
|
Ok(log_path) => log_path.to_str().unwrap().to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user