diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-05-25 11:09:54 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-05-25 11:09:54 +0530 |
| commit | b31e16554ccc95b1f6996aa3573a8036132da3a4 (patch) | |
| tree | b09b565f49d42026e55de6ba1a1bf86d3f4bea4a | |
| parent | 48fd5a7508ca960ebcaabb6ad7f7b820d2013b23 (diff) | |
workaround for #7
| -rwxr-xr-x | src/app.rs | 25 | ||||
| -rwxr-xr-x | src/browser.rs | 7 |
2 files changed, 21 insertions, 11 deletions
@@ -117,10 +117,14 @@ impl App { let songs = self.conn.conn.listfiles(&file).unwrap_or_default(); for (t, f) in songs.iter() { if t == "file" { - if let Some(full_path) = &self.conn.get_full_path(f) { - let song = self.conn.get_song_with_only_filename(full_path); - self.conn.conn.push(&song)?; - } + let path = self.browser.prev_path.to_string() + + "/" + + self.browser.path.as_str() + + "/" + + f; + let full_path = path.strip_prefix("./").unwrap_or_else(|| ""); + let song = self.conn.get_song_with_only_filename(full_path); + self.conn.conn.push(&song)?; } } } else if content_type == "file" { @@ -134,10 +138,15 @@ impl App { } if !status { - if let Some(full_path) = &self.conn.get_full_path(content) { - let song = self.conn.get_song_with_only_filename(full_path); - self.conn.conn.push(&song)?; - } + let path = self.browser.prev_path.to_string() + + "/" + + self.browser.path.as_str() + + "/" + + content; + let full_path = path.strip_prefix("./").unwrap_or_else(|| ""); + + let song = self.conn.get_song_with_only_filename(full_path); + self.conn.conn.push(&song)?; } } diff --git a/src/browser.rs b/src/browser.rs index f1972ef..4cc5a56 100755 --- a/src/browser.rs +++ b/src/browser.rs @@ -89,9 +89,10 @@ impl FileBrowser { let v = conn .conn .lsinfo(Song { - file: conn - .get_full_path(song) - .unwrap_or_else(|| "Not a song".to_string()), + file: (self.path.clone() + "/" + song) + .strip_prefix("./") + .unwrap_or_else(|| "") + .to_string(), ..Default::default() }) .unwrap_or_else(|_| { |
