···8282same-file = "1.0.6"
8383# Open generated docs in browser
8484opener = "0.6"
8585+camino = { version = "1.1.6", features = ["serde1"] }
85868687[dev-dependencies]
8788# Test assertion errors with diffs
···11-use std::path::Path;
21use std::time::Instant;
22+33+use camino::Utf8Path;
3445use crate::{cli, hex::ApiKeyCommand, http::HttpClient};
56use gleam_core::{
···8485 println!(
8586 "\nThe documentation for {package} has been rendered to \n{index_html}",
8687 package = config.name,
8787- index_html = index_html.to_string_lossy()
8888+ index_html = index_html
8889 );
89909091 if options.open {
···99100///
100101/// For the docs this will generally be a browser (unless some other program is
101102/// configured as the default for `.html` files).
102102-fn open_docs(path: &Path) -> Result<()> {
103103+fn open_docs(path: &Utf8Path) -> Result<()> {
103104 opener::open(path).map_err(|error| Error::FailedToOpenDocs {
104105 path: path.to_path_buf(),
105106 error: error.to_string(),
···99 { path = "std::path::Path::read_link", reason = "IO is not permitted in core" },
1010 { path = "std::path::Path::symlink_metadata", reason = "IO is not permitted in core" },
1111 { path = "std::path::Path::try_exists", reason = "IO is not permitted in core" },
1212+1313+ { path = "camino::Utf8Path::canonicalize", reason = "IO is not permitted in core" },
1414+ { path = "camino::Utf8Path::exists", reason = "IO is not permitted in core" },
1515+ { path = "camino::Utf8Path::is_dir", reason = "IO is not permitted in core" },
1616+ { path = "camino::Utf8Path::is_file", reason = "IO is not permitted in core" },
1717+ { path = "camino::Utf8Path::is_symlink", reason = "IO is not permitted in core" },
1818+ { path = "camino::Utf8Path::read_dir", reason = "IO is not permitted in core" },
1919+ { path = "camino::Utf8Path::read_link", reason = "IO is not permitted in core" },
2020+ { path = "camino::Utf8Path::symlink_metadata", reason = "IO is not permitted in core" },
2121+ { path = "camino::Utf8Path::try_exists", reason = "IO is not permitted in core" },
2222+2323+2424+ { path = "std::path::Path::new", reason = "Manually constructed paths should use camino::Utf8Path" },
2525+ { path = "std::path::PathBuf::new", reason = "Manually constructed pathbufs should use camino::Utf8Path" },
1226]
···11+use camino::Utf8Path;
12use debug_ignore::DebugIgnore;
23use flate2::read::GzDecoder;
34use futures::future;
45use hexpm::version::Version;
55-use std::path::Path;
66use tar::Archive;
7788use crate::{
···209209210210 // It would be really nice if this was async but the library is sync
211211 pub fn extract_package_from_cache(&self, name: &str, version: &Version) -> Result<bool> {
212212- let contents_path = Path::new("contents.tar.gz");
212212+ let contents_path = Utf8Path::new("contents.tar.gz");
213213 let destination = self.paths.build_packages_package(name);
214214215215 // If the directory already exists then there's nothing for us to do
···1414 warning::VectorWarningEmitterIO,
1515 Error, Result, Warning,
1616};
1717-use std::{collections::HashMap, path::PathBuf, sync::Arc};
1717+use std::{collections::HashMap, sync::Arc};
1818+1919+use camino::Utf8PathBuf;
18201921/// A wrapper around the project compiler which makes it possible to repeatedly
2022/// recompile the top level package, reusing the information about the already
···9193 })
9294 }
93959494- pub fn compile(&mut self) -> Result<Vec<PathBuf>, Error> {
9696+ pub fn compile(&mut self) -> Result<Vec<Utf8PathBuf>, Error> {
9597 // Lock the build directory to ensure to ensure we are the only one compiling
9698 let _lock_guard = self.locker.lock_for_build();
9799