From f023445d609d799d4df6376d7bf1aa44852cb073 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sat, 2 Apr 2022 22:02:09 +0200 Subject: [PATCH] set correct playlist plath, get playlist in read mode --- src/utils/json_reader.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/json_reader.rs b/src/utils/json_reader.rs index 71fc8473..8fcd8697 100644 --- a/src/utils/json_reader.rs +++ b/src/utils/json_reader.rs @@ -62,6 +62,7 @@ pub fn read_json( let mut current_file: String = playlist_path.as_path().display().to_string(); if let Some(p) = path { + playlist_path = Path::new(&p).to_owned(); current_file = p } @@ -73,7 +74,11 @@ pub fn read_json( info!("Read Playlist: {}", ¤t_file); - let f = File::open(¤t_file).expect("Could not open json playlist file."); + let f = File::options() + .read(true) + .write(false) + .open(¤t_file) + .expect("Could not open json playlist file."); let mut playlist: Playlist = serde_json::from_reader(f).expect("Could not read json playlist file.");