forked from rojo-rbx/rojo
Merge branch 'feature/init-name-resolution'
This commit is contained in:
@@ -109,11 +109,15 @@ pub fn syncback_csv<'sync>(
|
|||||||
|
|
||||||
if !meta.is_empty() {
|
if !meta.is_empty() {
|
||||||
let parent = snapshot.path.parent_err()?;
|
let parent = snapshot.path.parent_err()?;
|
||||||
let meta_stem = snapshot.path
|
let meta_stem = snapshot.middleware
|
||||||
.file_name()
|
.and_then(|mw| {
|
||||||
.and_then(|n| n.to_str())
|
let ext = format!(".{}", crate::syncback::extension_for_middleware(mw));
|
||||||
.map(|s| s.split('.').next().unwrap_or(s))
|
snapshot.path.file_name()
|
||||||
.unwrap_or_else(|| new_inst.name.as_str());
|
.and_then(|n| n.to_str())
|
||||||
|
.and_then(|s| s.strip_suffix(ext.as_str()))
|
||||||
|
.map(str::to_owned)
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| new_inst.name.clone());
|
||||||
fs_snapshot.add_file(
|
fs_snapshot.add_file(
|
||||||
parent.join(format!("{meta_stem}.meta.json")),
|
parent.join(format!("{meta_stem}.meta.json")),
|
||||||
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
|
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
|
||||||
|
|||||||
@@ -158,11 +158,15 @@ pub fn syncback_lua<'sync>(
|
|||||||
|
|
||||||
if !meta.is_empty() {
|
if !meta.is_empty() {
|
||||||
let parent_location = snapshot.path.parent_err()?;
|
let parent_location = snapshot.path.parent_err()?;
|
||||||
let meta_stem = snapshot.path
|
let meta_stem = snapshot.middleware
|
||||||
.file_name()
|
.and_then(|mw| {
|
||||||
.and_then(|n| n.to_str())
|
let ext = format!(".{}", crate::syncback::extension_for_middleware(mw));
|
||||||
.map(|s| s.split('.').next().unwrap_or(s))
|
snapshot.path.file_name()
|
||||||
.unwrap_or_else(|| snapshot.new_inst().name.as_str());
|
.and_then(|n| n.to_str())
|
||||||
|
.and_then(|s| s.strip_suffix(ext.as_str()))
|
||||||
|
.map(str::to_owned)
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| snapshot.new_inst().name.clone());
|
||||||
fs_snapshot.add_file(
|
fs_snapshot.add_file(
|
||||||
parent_location.join(format!("{meta_stem}.meta.json")),
|
parent_location.join(format!("{meta_stem}.meta.json")),
|
||||||
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
|
serde_json::to_vec_pretty(&meta).context("cannot serialize metadata")?,
|
||||||
|
|||||||
@@ -58,11 +58,15 @@ pub fn syncback_txt<'sync>(
|
|||||||
|
|
||||||
if !meta.is_empty() {
|
if !meta.is_empty() {
|
||||||
let parent = snapshot.path.parent_err()?;
|
let parent = snapshot.path.parent_err()?;
|
||||||
let meta_stem = snapshot.path
|
let meta_stem = snapshot.middleware
|
||||||
.file_name()
|
.and_then(|mw| {
|
||||||
.and_then(|n| n.to_str())
|
let ext = format!(".{}", crate::syncback::extension_for_middleware(mw));
|
||||||
.map(|s| s.split('.').next().unwrap_or(s))
|
snapshot.path.file_name()
|
||||||
.unwrap_or_else(|| new_inst.name.as_str());
|
.and_then(|n| n.to_str())
|
||||||
|
.and_then(|s| s.strip_suffix(ext.as_str()))
|
||||||
|
.map(str::to_owned)
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| new_inst.name.clone());
|
||||||
fs_snapshot.add_file(
|
fs_snapshot.add_file(
|
||||||
parent.join(format!("{meta_stem}.meta.json")),
|
parent.join(format!("{meta_stem}.meta.json")),
|
||||||
serde_json::to_vec_pretty(&meta).context("could not serialize metadata")?,
|
serde_json::to_vec_pretty(&meta).context("could not serialize metadata")?,
|
||||||
|
|||||||
Reference in New Issue
Block a user