Skip to content

Commit 700c1b9

Browse files
committed
fixed app key loading
1 parent a22d84d commit 700c1b9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src-tauri/src/device_manager/privkey.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ impl PrivateKey {
1010
pub fn content(&self, ssh_dir: Option<&Path>) -> Result<String, Error> {
1111
match self {
1212
PrivateKey::Path { name } => {
13-
let mut secret_file =
14-
std::fs::File::open(ssh_dir.ok_or(Error::bad_config())?.join(name))?;
13+
let mut ssh_dir = ssh_dir.ok_or(Error::bad_config())?;
14+
if cfg!(mobile) {
15+
let ssh_parent = ssh_dir.parent().ok_or(Error::bad_config())?;
16+
if ssh_parent.join(name).is_file() {
17+
ssh_dir = ssh_parent;
18+
}
19+
}
20+
let mut secret_file = std::fs::File::open(ssh_dir.join(name))?;
1521
let mut secret = String::new();
1622
secret_file.read_to_string(&mut secret)?;
1723
Ok(secret)

0 commit comments

Comments
 (0)