mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
impr: Handle provider opening more centrally, switch to existing provider if same file is being opened again
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace hex::plugin::remote {
|
||||
|
||||
bool SSHProvider::open() {
|
||||
prv::Provider::OpenResult SSHProvider::open() {
|
||||
if (!m_sftpClient.isConnected()) {
|
||||
try {
|
||||
if (m_authMethod == AuthMethod::Password) {
|
||||
@@ -22,8 +22,7 @@ namespace hex::plugin::remote {
|
||||
m_sftpClient = std::move(client);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
setErrorMessage(e.what());
|
||||
return false;
|
||||
return OpenResult::failure(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +32,14 @@ namespace hex::plugin::remote {
|
||||
else
|
||||
m_remoteFile = m_sftpClient.openFileSFTP(m_remoteFilePath, SSHClient::OpenMode::ReadWrite);
|
||||
} catch (const std::exception& e) {
|
||||
setErrorMessage(e.what());
|
||||
return false;
|
||||
return OpenResult::failure(e.what());
|
||||
}
|
||||
|
||||
return m_remoteFile->isOpen();
|
||||
if (!m_remoteFile->isOpen()) {
|
||||
return OpenResult::failure("hex.plugin.remote.ssh_provider.error.open_failed"_lang);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SSHProvider::close() {
|
||||
|
||||
Reference in New Issue
Block a user