mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-11 10:44:38 +00:00
address review: OCIO FileTransform files read through the bounded regular-file reader
This commit is contained in:
@@ -284,7 +284,7 @@ pub fn load_file(src: &str) -> Option<Arc<FileXform>> {
|
||||
parse_file(src, "")
|
||||
} else {
|
||||
let ext = std::path::Path::new(src_t).extension().and_then(std::ffi::OsStr::to_str).unwrap_or("");
|
||||
std::fs::read_to_string(src_t).ok().and_then(|t| parse_file(&t, ext))
|
||||
crate::utility::read_text_file(std::path::Path::new(src_t)).ok().and_then(|t| parse_file(&t, ext))
|
||||
}
|
||||
.map(Arc::new);
|
||||
if let Ok(mut m) = cache.lock() {
|
||||
|
||||
@@ -695,6 +695,8 @@ mod read_text_file_tests {
|
||||
assert!(std::process::Command::new("mkfifo").arg(&fifo).status().unwrap().success());
|
||||
// Opening a FIFO with no writer would block: this returns at once.
|
||||
assert!(super::read_text_file(&fifo).is_err());
|
||||
// An OCIO FileTransform source reads through the same bounded reader.
|
||||
assert!(crate::ocio::load_file(&fifo.to_string_lossy()).is_none());
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user