mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
More consistent handling of non-Unicode file names (should be rare)
This commit is contained in:
@@ -9,7 +9,10 @@ use crate::{
|
|||||||
snapshot::InstanceSnapshot,
|
snapshot::InstanceSnapshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware};
|
use super::{
|
||||||
|
error::SnapshotError,
|
||||||
|
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SnapshotJsonModel;
|
pub struct SnapshotJsonModel;
|
||||||
|
|
||||||
@@ -22,7 +25,12 @@ impl SnapshotMiddleware for SnapshotJsonModel {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
let file_name = entry
|
||||||
|
.path()
|
||||||
|
.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?;
|
||||||
|
|
||||||
let instance_name = match match_trailing(&file_name, ".model.json") {
|
let instance_name = match match_trailing(&file_name, ".model.json") {
|
||||||
Some(name) => name.to_owned(),
|
Some(name) => name.to_owned(),
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ use crate::{
|
|||||||
snapshot::InstanceSnapshot,
|
snapshot::InstanceSnapshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware};
|
use super::{
|
||||||
|
error::SnapshotError,
|
||||||
|
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SnapshotRbxlx;
|
pub struct SnapshotRbxlx;
|
||||||
|
|
||||||
@@ -20,7 +23,12 @@ impl SnapshotMiddleware for SnapshotRbxlx {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
let file_name = entry
|
||||||
|
.path()
|
||||||
|
.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?;
|
||||||
|
|
||||||
if !file_name.ends_with(".rbxlx") {
|
if !file_name.ends_with(".rbxlx") {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
@@ -30,7 +38,8 @@ impl SnapshotMiddleware for SnapshotRbxlx {
|
|||||||
.path()
|
.path()
|
||||||
.file_stem()
|
.file_stem()
|
||||||
.expect("Could not extract file stem")
|
.expect("Could not extract file stem")
|
||||||
.to_string_lossy()
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let options = rbx_xml::DecodeOptions::new()
|
let options = rbx_xml::DecodeOptions::new()
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ use crate::{
|
|||||||
snapshot::InstanceSnapshot,
|
snapshot::InstanceSnapshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware};
|
use super::{
|
||||||
|
error::SnapshotError,
|
||||||
|
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SnapshotRbxm;
|
pub struct SnapshotRbxm;
|
||||||
|
|
||||||
@@ -20,7 +23,12 @@ impl SnapshotMiddleware for SnapshotRbxm {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
let file_name = entry
|
||||||
|
.path()
|
||||||
|
.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?;
|
||||||
|
|
||||||
if !file_name.ends_with(".rbxm") {
|
if !file_name.ends_with(".rbxm") {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
@@ -30,7 +38,8 @@ impl SnapshotMiddleware for SnapshotRbxm {
|
|||||||
.path()
|
.path()
|
||||||
.file_stem()
|
.file_stem()
|
||||||
.expect("Could not extract file stem")
|
.expect("Could not extract file stem")
|
||||||
.to_string_lossy()
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let mut temp_tree = RbxTree::new(RbxInstanceProperties {
|
let mut temp_tree = RbxTree::new(RbxInstanceProperties {
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ use crate::{
|
|||||||
snapshot::InstanceSnapshot,
|
snapshot::InstanceSnapshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware};
|
use super::{
|
||||||
|
error::SnapshotError,
|
||||||
|
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct SnapshotRbxmx;
|
pub struct SnapshotRbxmx;
|
||||||
|
|
||||||
@@ -20,7 +23,12 @@ impl SnapshotMiddleware for SnapshotRbxmx {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_name = entry.path().file_name().unwrap().to_string_lossy();
|
let file_name = entry
|
||||||
|
.path()
|
||||||
|
.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?;
|
||||||
|
|
||||||
if !file_name.ends_with(".rbxmx") {
|
if !file_name.ends_with(".rbxmx") {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
@@ -30,7 +38,8 @@ impl SnapshotMiddleware for SnapshotRbxmx {
|
|||||||
.path()
|
.path()
|
||||||
.file_stem()
|
.file_stem()
|
||||||
.expect("Could not extract file stem")
|
.expect("Could not extract file stem")
|
||||||
.to_string_lossy()
|
.to_str()
|
||||||
|
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let options = rbx_xml::DecodeOptions::new()
|
let options = rbx_xml::DecodeOptions::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user