diff --git a/Cargo.lock b/Cargo.lock index 7b8e41a..aa96464 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -746,7 +746,7 @@ dependencies = [ [[package]] name = "flying-carpet" -version = "8.0.0" +version = "8.0.1" dependencies = [ "flying-carpet-core", "serde", @@ -758,7 +758,7 @@ dependencies = [ [[package]] name = "flying-carpet-core" -version = "8.0.0" +version = "8.0.1" dependencies = [ "aes-gcm", "rand 0.8.5", diff --git a/Flying Carpet/src-tauri/Cargo.toml b/Flying Carpet/src-tauri/Cargo.toml index 7334c22..d7810a0 100644 --- a/Flying Carpet/src-tauri/Cargo.toml +++ b/Flying Carpet/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flying-carpet" -version = "8.0.0" +version = "8.0.1" description = "Encrypted file transfer over ad hoc WiFi between Android, iOS, Linux, macOS, and Windows" authors = ["Theron Spiegl"] license = "GPL-3.0-only" diff --git a/Flying Carpet/src-tauri/tauri.conf.json b/Flying Carpet/src-tauri/tauri.conf.json index b0c3b20..3fe31ff 100644 --- a/Flying Carpet/src-tauri/tauri.conf.json +++ b/Flying Carpet/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "FlyingCarpet", - "version": "8.0.0" + "version": "8.0.1" }, "tauri": { "allowlist": { diff --git a/Flying Carpet/src/main.js b/Flying Carpet/src/main.js index efab03d..9356bc8 100644 --- a/Flying Carpet/src/main.js +++ b/Flying Carpet/src/main.js @@ -383,9 +383,9 @@ window.modeChange = modeChange; window.peerChange = peerChange; const aboutMessage = `https://flyingcarpet.spiegl.dev -Version: 8.0 +Version: 8.0.1 theron@spiegl.dev -Copyright (c) 2023, Theron Spiegl +Copyright (c) 2024, Theron Spiegl All rights reserved. Flying Carpet performs file transfers between two laptops or phones (Android, iOS, Linux, Mac, Windows) via ad hoc WiFi. No access point or network gear is required. Just select a file, whether each device is sending or receiving, and the operating system of the other device. For mobile versions, search for "Flying Carpet File Transfer" in the Apple App Store or Google Play Store. diff --git a/LICENSE.txt b/LICENSE.txt index db51c6d..280f95a 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2023, Theron Spiegl +Copyright (c) 2024, Theron Spiegl All rights reserved. GNU GENERAL PUBLIC LICENSE diff --git a/core/Cargo.toml b/core/Cargo.toml index f90e9ca..54d1b1d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flying-carpet-core" -version = "8.0.0" +version = "8.0.1" edition = "2021" license = "GPL-3.0-only" diff --git a/core/src/lib.rs b/core/src/lib.rs index 5b8ef84..a297719 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -10,7 +10,7 @@ use sha2::{Digest, Sha256}; use std::{ error::Error, net::SocketAddr, - path::PathBuf, + path::{PathBuf, Path}, str::FromStr, sync::{Arc, Mutex}, }; @@ -178,16 +178,19 @@ pub async fn start_transfer( } } // find folder common to all files - let mut common_folder = files[0].parent().expect("file has no parent"); + let mut common_folder = files[0].parent().or(Some(Path::new(""))).unwrap(); if files.len() > 1 { for file in &files[1..] { - let current = file.parent().expect("file has no parent"); - if current.components().collect::>().len() < common_folder.components().collect::>().len() { + let current = file.parent().or(Some(Path::new(""))).unwrap(); + let current_len = current.components().collect::>().len(); + let common_len = common_folder.components().collect::>().len(); + if current_len < common_len { common_folder = current; + } else if current_len == common_len { + common_folder = current.parent().or(Some(Path::new(""))).unwrap(); } } } - ui.output(&format!("common folder: {}", common_folder.display())); // send files for (i, file) in files.iter().enumerate() { let file_name = file