mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 07:06:12 +00:00
Fix ordering not being preserved in Vfs
This commit is contained in:
@@ -108,9 +108,21 @@ impl<F: VfsFetcher> Vfs<F> {
|
|||||||
VfsItem::Directory(dir) => {
|
VfsItem::Directory(dir) => {
|
||||||
self.fetcher.watch(path);
|
self.fetcher.watch(path);
|
||||||
|
|
||||||
let enumerated = dir.children_enumerated;
|
// If the directory hasn't been marked as enumerated yet, find
|
||||||
|
// all of its children and insert them into the VFS.
|
||||||
|
if !dir.children_enumerated {
|
||||||
|
dir.children_enumerated = true;
|
||||||
|
|
||||||
|
let children = self
|
||||||
|
.fetcher
|
||||||
|
.read_children(path)
|
||||||
|
.map_err(|err| FsError::new(err, path.to_path_buf()))?;
|
||||||
|
|
||||||
|
for path in children {
|
||||||
|
Self::get_internal(&mut data, &self.fetcher, path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if enumerated {
|
|
||||||
data.children(path)
|
data.children(path)
|
||||||
.unwrap() // TODO: Handle None here, which means the PathMap entry did not exist.
|
.unwrap() // TODO: Handle None here, which means the PathMap entry did not exist.
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -119,16 +131,6 @@ impl<F: VfsFetcher> Vfs<F> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|path| Self::get_internal(&mut data, &self.fetcher, path))
|
.map(|path| Self::get_internal(&mut data, &self.fetcher, path))
|
||||||
.collect::<FsResult<Vec<VfsEntry>>>()
|
.collect::<FsResult<Vec<VfsEntry>>>()
|
||||||
} else {
|
|
||||||
dir.children_enumerated = true;
|
|
||||||
|
|
||||||
self.fetcher
|
|
||||||
.read_children(path)
|
|
||||||
.map_err(|err| FsError::new(err, path.to_path_buf()))?
|
|
||||||
.into_iter()
|
|
||||||
.map(|path| Self::get_internal(&mut data, &self.fetcher, path))
|
|
||||||
.collect::<FsResult<Vec<VfsEntry>>>()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
VfsItem::File(_) => Err(FsError::new(
|
VfsItem::File(_) => Err(FsError::new(
|
||||||
io::Error::new(io::ErrorKind::Other, "Can't read a directory"),
|
io::Error::new(io::ErrorKind::Other, "Can't read a directory"),
|
||||||
|
|||||||
Reference in New Issue
Block a user