mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-22 21:55:15 +00:00
Keep track of actual file name in VfsItem.
This should fix the case of a partition pointed directly at a file turning the object into a `StringValue`. Fixes #57.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## Current Master
|
## Current Master
|
||||||
* Rojo now throws an error if no project file is found. ([#63](https://github.com/LPGhatguy/rojo/issues/63))
|
* Rojo now throws an error if no project file is found. ([#63](https://github.com/LPGhatguy/rojo/issues/63))
|
||||||
* Fixed multiple sync operations occuring at the same time. ([#61](https://github.com/LPGhatguy/rojo/issues/61))
|
* Fixed multiple sync operations occuring at the same time. ([#61](https://github.com/LPGhatguy/rojo/issues/61))
|
||||||
|
* Partitions targeting files directly now work as expected. ([#57](https://github.com/LPGhatguy/rojo/issues/57))
|
||||||
|
|
||||||
## 0.4.4 (April 7, 2018)
|
## 0.4.4 (April 7, 2018)
|
||||||
* Fix small regression introduced in 0.4.3
|
* Fix small regression introduced in 0.4.3
|
||||||
|
|||||||
@@ -9,17 +9,22 @@ use std::collections::HashMap;
|
|||||||
pub enum VfsItem {
|
pub enum VfsItem {
|
||||||
File {
|
File {
|
||||||
route: Vec<String>,
|
route: Vec<String>,
|
||||||
|
file_name: String,
|
||||||
contents: String,
|
contents: String,
|
||||||
},
|
},
|
||||||
Dir {
|
Dir {
|
||||||
route: Vec<String>,
|
route: Vec<String>,
|
||||||
|
file_name: String,
|
||||||
children: HashMap<String, VfsItem>,
|
children: HashMap<String, VfsItem>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VfsItem {
|
impl VfsItem {
|
||||||
pub fn name(&self) -> &String {
|
pub fn name(&self) -> &String {
|
||||||
self.route().last().unwrap()
|
match self {
|
||||||
|
&VfsItem::File { ref file_name , .. } => file_name,
|
||||||
|
&VfsItem::Dir { ref file_name , .. } => file_name,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn route(&self) -> &[String] {
|
pub fn route(&self) -> &[String] {
|
||||||
|
|||||||
@@ -111,8 +111,11 @@ impl VfsSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let file_name = path.file_name().unwrap().to_string_lossy().into_owned();
|
||||||
|
|
||||||
Ok(VfsItem::Dir {
|
Ok(VfsItem::Dir {
|
||||||
route: route.iter().cloned().collect::<Vec<_>>(),
|
route: route.iter().cloned().collect::<Vec<_>>(),
|
||||||
|
file_name,
|
||||||
children,
|
children,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -131,8 +134,11 @@ impl VfsSession {
|
|||||||
Err(_) => return Err(()),
|
Err(_) => return Err(()),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let file_name = path.file_name().unwrap().to_string_lossy().into_owned();
|
||||||
|
|
||||||
Ok(VfsItem::File {
|
Ok(VfsItem::File {
|
||||||
route: route.iter().cloned().collect::<Vec<_>>(),
|
route: route.iter().cloned().collect::<Vec<_>>(),
|
||||||
|
file_name,
|
||||||
contents,
|
contents,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user