forked from rojo-rbx/rojo
Normalize line endings to LF in Lua middleware (#854)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use std::{collections::HashMap, path::Path, str};
|
||||
|
||||
use anyhow::Context;
|
||||
use memofs::{IoResultExt, Vfs};
|
||||
use rbx_dom_weak::types::Enum;
|
||||
|
||||
@@ -40,10 +39,8 @@ pub fn snapshot_lua(
|
||||
(_, ScriptType::Module) => ("ModuleScript", None),
|
||||
};
|
||||
|
||||
let contents = vfs.read(path)?;
|
||||
let contents_str = str::from_utf8(&contents)
|
||||
.with_context(|| format!("File was not valid UTF-8: {}", path.display()))?
|
||||
.to_owned();
|
||||
let contents = vfs.read_to_string_lf_normalized(path)?;
|
||||
let contents_str = contents.as_str();
|
||||
|
||||
let mut properties = HashMap::with_capacity(2);
|
||||
properties.insert("Source".to_owned(), contents_str.into());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{path::Path, str};
|
||||
|
||||
use anyhow::Context;
|
||||
use maplit::hashmap;
|
||||
use memofs::{IoResultExt, Vfs};
|
||||
|
||||
@@ -14,10 +13,8 @@ pub fn snapshot_txt(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||
let contents = vfs.read(path)?;
|
||||
let contents_str = str::from_utf8(&contents)
|
||||
.with_context(|| format!("File was not valid UTF-8: {}", path.display()))?
|
||||
.to_owned();
|
||||
let contents = vfs.read_to_string(path)?;
|
||||
let contents_str = contents.as_str();
|
||||
|
||||
let properties = hashmap! {
|
||||
"Value".to_owned() => contents_str.into(),
|
||||
|
||||
Reference in New Issue
Block a user