mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-19 22:19:49 -04:00
make directories not have extensions (#83)
* fix: #78 * Update core/src/file/indexer/scan.rs Co-authored-by: maxichrome <33473181+maxichrome@users.noreply.github.com> Co-authored-by: maxichrome <33473181+maxichrome@users.noreply.github.com>
This commit is contained in:
@@ -172,8 +172,20 @@ fn prepare_values(
|
||||
let metadata = fs::metadata(&file_path)?;
|
||||
let location_path = location.path.as_ref().unwrap().as_str();
|
||||
// let size = metadata.len();
|
||||
let name = extract_name(file_path.file_stem());
|
||||
let extension = extract_name(file_path.extension());
|
||||
let name;
|
||||
let extension;
|
||||
|
||||
// if the 'file_path' is not a directory, then get the extension and name.
|
||||
|
||||
// if 'file_path' is a directory, set extension to an empty string to avoid periods in folder names
|
||||
// - being interpreted as file extensions
|
||||
if file_path.is_dir() {
|
||||
extension = "".to_string();
|
||||
name = extract_name(file_path.file_name());
|
||||
} else {
|
||||
extension = extract_name(file_path.extension());
|
||||
name = extract_name(file_path.file_stem());
|
||||
}
|
||||
|
||||
let materialized_path = match file_path.to_str() {
|
||||
Some(p) => p
|
||||
|
||||
Reference in New Issue
Block a user