Capture portable path serialization in a struct (#5652)

## Summary

I need to reuse this in #5494, so want to abstract it out and make it
reusable.
This commit is contained in:
Charlie Marsh 2024-07-31 12:00:37 -04:00 committed by GitHub
parent 8d14a4cb4f
commit dfec262586
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 169 additions and 79 deletions

View file

@ -26,7 +26,6 @@ uv-installer = { workspace = true }
dirs-sys = { workspace = true }
fs-err = { workspace = true }
path-slash = { workspace = true }
pathdiff = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

View file

@ -1,13 +1,14 @@
use std::path::PathBuf;
use path_slash::PathBufExt;
use pypi_types::VerbatimParsedUrl;
use serde::Deserialize;
use toml_edit::value;
use toml_edit::Array;
use toml_edit::Table;
use toml_edit::Value;
use pypi_types::VerbatimParsedUrl;
use uv_fs::PortablePath;
/// A tool entry.
#[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
@ -127,7 +128,7 @@ impl ToolEntrypoint {
table.insert(
"install-path",
// Use cross-platform slashes so the toml string type does not change
value(self.install_path.to_slash_lossy().to_string()),
value(PortablePath::from(&self.install_path).to_string()),
);
table
}