|
1 |
| -use crate::filesystem::{DIRECTORY, FILE}; |
| 1 | +use crate::filesystem::FileType; |
2 | 2 | use crate::{AppState, CachedPath, StateSafe, VolumeCache};
|
3 | 3 | use lazy_static::lazy_static;
|
4 | 4 | use notify::event::{CreateKind, ModifyKind, RenameMode};
|
@@ -50,11 +50,10 @@ impl FsEventHandler {
|
50 | 50 |
|
51 | 51 | let filename = path.file_name().unwrap().to_string_lossy().to_string();
|
52 | 52 | let file_type = match kind {
|
53 |
| - CreateKind::File => FILE, |
54 |
| - CreateKind::Folder => DIRECTORY, |
| 53 | + CreateKind::File => FileType::File, |
| 54 | + CreateKind::Folder => FileType::Directory, |
55 | 55 | _ => return, // Other options are weird lol
|
56 |
| - } |
57 |
| - .to_string(); |
| 56 | + }; |
58 | 57 |
|
59 | 58 | let file_path = path.to_string_lossy().to_string();
|
60 | 59 | current_volume.entry(filename).or_insert_with(|| vec![CachedPath {
|
@@ -97,12 +96,12 @@ impl FsEventHandler {
|
97 | 96 | let current_volume = self.get_from_cache(state);
|
98 | 97 |
|
99 | 98 | let filename = new_path.file_name().unwrap().to_string_lossy().to_string();
|
100 |
| - let file_type = if new_path.is_dir() { DIRECTORY } else { FILE }; |
| 99 | + let file_type = if new_path.is_dir() { FileType::Directory } else { FileType::File }; |
101 | 100 |
|
102 | 101 | let path_string = new_path.to_string_lossy().to_string();
|
103 | 102 | current_volume.entry(filename).or_insert_with(|| vec![CachedPath {
|
104 | 103 | file_path: path_string,
|
105 |
| - file_type: String::from(file_type), |
| 104 | + file_type: file_type, |
106 | 105 | }]);
|
107 | 106 | }
|
108 | 107 |
|
|
0 commit comments