Skip to content

Commit 7c7dbe7

Browse files
Cheong-Laujacobgkau
authored andcommitted
fix: update network path when entering uri
closes: #1406
1 parent 1142921 commit 7c7dbe7

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/mounter/gvfs.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@ fn network_scan(uri: &str, sizes: IconSizes) -> Result<Vec<tab::Item>, String> {
217217
Ok(items)
218218
}
219219

220-
fn dir_info(uri: &str) -> Result<(String, String), glib::Error> {
220+
fn dir_info(uri: &str) -> Result<(String, String, Option<PathBuf>), glib::Error> {
221221
let (resolved_uri, file) = resolve_uri(uri);
222222
let info = file.query_info(
223223
gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
224224
gio::FileQueryInfoFlags::NONE,
225225
gio::Cancellable::NONE,
226226
)?;
227227

228-
Ok((resolved_uri, info.display_name().into()))
228+
Ok((resolved_uri, info.display_name().into(), file.path()))
229229
}
230230

231231
fn mount_op(uri: String, event_tx: mpsc::UnboundedSender<Event>) -> gio::MountOperation {
@@ -288,7 +288,10 @@ enum Cmd {
288288
IconSizes,
289289
mpsc::Sender<Result<Vec<tab::Item>, String>>,
290290
),
291-
DirInfo(String, mpsc::Sender<Result<(String, String), glib::Error>>),
291+
DirInfo(
292+
String,
293+
mpsc::Sender<Result<(String, String, Option<PathBuf>), glib::Error>>,
294+
),
292295
Unmount(MounterItem),
293296
}
294297

@@ -651,7 +654,7 @@ impl Mounter for Gvfs {
651654
items_rx.blocking_recv()
652655
}
653656

654-
fn dir_info(&self, uri: &str) -> Option<(String, String)> {
657+
fn dir_info(&self, uri: &str) -> Option<(String, String, Option<PathBuf>)> {
655658
let (result_tx, mut result_rx) = mpsc::channel(1);
656659
self.command_tx
657660
.send(Cmd::DirInfo(uri.to_string(), result_tx))

src/mounter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub trait Mounter: Send + Sync {
116116
fn mount(&self, item: MounterItem) -> Task<()>;
117117
fn network_drive(&self, uri: String) -> Task<()>;
118118
fn network_scan(&self, uri: &str, sizes: IconSizes) -> Option<Result<Vec<tab::Item>, String>>;
119-
fn dir_info(&self, uri: &str) -> Option<(String, String)>;
119+
fn dir_info(&self, uri: &str) -> Option<(String, String, Option<PathBuf>)>;
120120
fn unmount(&self, item: MounterItem) -> Task<()>;
121121
fn subscription(&self) -> Subscription<MounterMessage>;
122122
}

src/tab.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,11 +1362,11 @@ pub struct EditLocation {
13621362

13631363
impl EditLocation {
13641364
pub fn resolve(&self) -> Option<Location> {
1365-
if let Location::Network(uri, _, path) = &self.location {
1365+
if let Location::Network(uri, ..) = &self.location {
13661366
MOUNTERS
13671367
.values()
13681368
.find_map(|mounter| mounter.dir_info(uri))
1369-
.map(|(uri, display_name)| Location::Network(uri, display_name, path.clone()))
1369+
.map(|(uri, display_name, path_opt)| Location::Network(uri, display_name, path_opt))
13701370
} else {
13711371
let Some(selected) = self.selected else {
13721372
return Some(self.location.clone());

0 commit comments

Comments
 (0)