From da9b6c21d6a45333a2ff099c0b39f2f6fc3b15d5 Mon Sep 17 00:00:00 2001 From: hstyi Date: Thu, 10 Apr 2025 13:23:44 +0800 Subject: [PATCH] fix: windows sftp path (#486) --- src/main/kotlin/app/termora/sftp/FileSystemViewNav.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/app/termora/sftp/FileSystemViewNav.kt b/src/main/kotlin/app/termora/sftp/FileSystemViewNav.kt index 92d4227..a1ad4ff 100644 --- a/src/main/kotlin/app/termora/sftp/FileSystemViewNav.kt +++ b/src/main/kotlin/app/termora/sftp/FileSystemViewNav.kt @@ -250,6 +250,13 @@ class FileSystemViewNav( textField.text = formatDisplayPath(file) textField.putClientProperty(PATH, file) + val fileSystem = fileSystemProvider.getFileSystem() + if (SystemInfo.isWindows && fileSystem is LocalFileSystem) { + if (!StringUtils.equals(fileSystem.rootURI, file.fileSystem.rootURI)) { + fileSystemProvider.setFileSystem(file.fileSystem) + } + } + for (listener in listenerList.getListeners(ActionListener::class.java)) { listener.actionPerformed(ActionEvent(this, ActionEvent.ACTION_PERFORMED, StringUtils.EMPTY)) }