Force unix path separators for engine values #47
9 changed files with 29 additions and 9 deletions
|
@ -7,6 +7,10 @@
|
|||
- dtmt: split `build` into `build` and `package`
|
||||
- dtmt: implement deploying built bundles
|
||||
|
||||
=== Fixed
|
||||
|
||||
- all: force unix path separators for engine values
|
||||
|
||||
== 2023-03-01
|
||||
|
||||
=== Added
|
||||
|
|
9
Cargo.lock
generated
9
Cargo.lock
generated
|
@ -676,6 +676,7 @@ dependencies = [
|
|||
"dtmt-shared",
|
||||
"futures",
|
||||
"oodle-sys",
|
||||
"path-slash",
|
||||
"sdk",
|
||||
"serde",
|
||||
"serde_sjson",
|
||||
|
@ -704,6 +705,7 @@ dependencies = [
|
|||
"nanorand",
|
||||
"oodle-sys",
|
||||
"path-clean",
|
||||
"path-slash",
|
||||
"pin-project-lite",
|
||||
"promptly",
|
||||
"sdk",
|
||||
|
@ -1699,6 +1701,12 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef"
|
||||
|
||||
[[package]]
|
||||
name = "path-slash"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42"
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.11.0"
|
||||
|
@ -2045,6 +2053,7 @@ dependencies = [
|
|||
"luajit2-sys",
|
||||
"nanorand",
|
||||
"oodle-sys",
|
||||
"path-slash",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
"serde_sjson",
|
||||
|
|
|
@ -23,3 +23,4 @@ tracing-error = "0.2.0"
|
|||
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
||||
zip = "0.6.4"
|
||||
tokio-stream = { version = "0.1.12", features = ["fs"] }
|
||||
path-slash = "0.2.1"
|
||||
|
|
|
@ -8,6 +8,7 @@ use color_eyre::eyre::Context;
|
|||
use color_eyre::{eyre, Help, Result};
|
||||
use futures::stream;
|
||||
use futures::StreamExt;
|
||||
use path_slash::PathBufExt;
|
||||
use sdk::filetype::lua;
|
||||
use sdk::filetype::package::Package;
|
||||
use sdk::murmur::Murmur64;
|
||||
|
@ -153,22 +154,22 @@ fn build_mod_data_lua(state: Arc<State>) -> String {
|
|||
lua.push_str(" new_mod(\"");
|
||||
lua.push_str(&mod_info.id);
|
||||
lua.push_str("\", {\n mod_script = \"");
|
||||
lua.push_str(&resources.init.to_string_lossy());
|
||||
lua.push_str(&resources.init.to_slash_lossy());
|
||||
|
||||
if let Some(data) = resources.data.as_ref() {
|
||||
lua.push_str("\",\n mod_data = \"");
|
||||
lua.push_str(&data.to_string_lossy());
|
||||
lua.push_str(&data.to_slash_lossy());
|
||||
}
|
||||
|
||||
if let Some(localization) = &resources.localization {
|
||||
lua.push_str("\",\n mod_localization = \"");
|
||||
lua.push_str(&localization.to_string_lossy());
|
||||
lua.push_str(&localization.to_slash_lossy());
|
||||
}
|
||||
|
||||
lua.push_str("\",\n })\n");
|
||||
} else {
|
||||
lua.push_str(" return dofile(\"");
|
||||
lua.push_str(&resources.init.to_string_lossy());
|
||||
lua.push_str(&resources.init.to_slash_lossy());
|
||||
lua.push_str("\")\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
|||
tracing = { version = "0.1.37", features = ["async-await"] }
|
||||
zip = "0.6.3"
|
||||
path-clean = "1.0.1"
|
||||
path-slash = "0.2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.3.0"
|
||||
|
|
|
@ -9,6 +9,7 @@ use color_eyre::{Help, Report};
|
|||
use dtmt_shared::ModConfig;
|
||||
use futures::future::try_join_all;
|
||||
use futures::StreamExt;
|
||||
use path_slash::PathExt;
|
||||
use sdk::filetype::package::Package;
|
||||
use sdk::murmur::IdString64;
|
||||
use sdk::{Bundle, BundleFile};
|
||||
|
@ -134,7 +135,7 @@ where
|
|||
path.set_extension("");
|
||||
|
||||
BundleFile::from_sjson(
|
||||
path.to_string_lossy().to_string(),
|
||||
path.to_slash_lossy().to_string(),
|
||||
file_type,
|
||||
sjson,
|
||||
root.as_ref(),
|
||||
|
@ -176,7 +177,7 @@ where
|
|||
.await
|
||||
.wrap_err_with(|| format!("failed to read file {}", path.display()))?;
|
||||
|
||||
let pkg_name = package.to_string_lossy().to_string();
|
||||
let pkg_name = package.to_slash_lossy().to_string();
|
||||
let pkg = Package::from_sjson(sjson, pkg_name.clone(), root)
|
||||
.await
|
||||
.wrap_err_with(|| format!("invalid package file {}", &pkg_name))?;
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::path::PathBuf;
|
|||
use clap::{value_parser, Arg, ArgMatches, Command};
|
||||
use color_eyre::eyre::{Context, Result};
|
||||
use color_eyre::Help;
|
||||
use path_slash::PathBufExt;
|
||||
use tokio::fs::{self, DirEntry};
|
||||
use tokio_stream::wrappers::ReadDirStream;
|
||||
use tokio_stream::StreamExt;
|
||||
|
@ -88,7 +89,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()>
|
|||
.await
|
||||
.wrap_err_with(|| format!("failed to read mod config at {}", path.display()))?;
|
||||
|
||||
zip.start_file(name.to_string_lossy(), Default::default())?;
|
||||
zip.start_file(name.to_slash_lossy(), Default::default())?;
|
||||
zip.write_all(&data)?;
|
||||
}
|
||||
|
||||
|
@ -111,7 +112,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()>
|
|||
let (name, data) = res?;
|
||||
|
||||
let name = base_path.join(name);
|
||||
zip.start_file(name.to_string_lossy(), Default::default())?;
|
||||
zip.start_file(name.to_slash_lossy(), Default::default())?;
|
||||
zip.write_all(&data)?;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -24,3 +24,4 @@ tracing = { version = "0.1.37", features = ["async-await"] }
|
|||
tracing-error = "0.2.0"
|
||||
luajit2-sys = "0.0.2"
|
||||
async-recursion = "1.0.2"
|
||||
path-slash = "0.2.1"
|
||||
|
|
|
@ -7,6 +7,7 @@ use std::str::FromStr;
|
|||
use async_recursion::async_recursion;
|
||||
use color_eyre::eyre::{self, Context};
|
||||
use color_eyre::Result;
|
||||
use path_slash::PathBufExt;
|
||||
use tokio::fs;
|
||||
|
||||
use crate::binary::sync::{ReadExt, WriteExt};
|
||||
|
@ -258,7 +259,7 @@ impl Package {
|
|||
for path in paths.iter() {
|
||||
w.write_u64(t.hash().into())?;
|
||||
|
||||
let hash = Murmur64::hash(path.to_string_lossy().as_bytes());
|
||||
let hash = Murmur64::hash(path.to_slash_lossy().as_bytes());
|
||||
w.write_u64(hash.into())?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue