From db2a65498174bf0efc93b21bb9d78986c41b26f8 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 5 Sep 2024 15:36:39 -0700 Subject: [PATCH] port: Warning/cfg fixes for some feature combinations * We need `base64/alloc` * `OsString` is only used in `member_export_path` * `member_export_path` is only used with `features = ["stl"]` --- all-is-cubes-port/Cargo.toml | 2 +- all-is-cubes-port/src/export.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/all-is-cubes-port/Cargo.toml b/all-is-cubes-port/Cargo.toml index 1a73a6c0e..aa94c7689 100644 --- a/all-is-cubes-port/Cargo.toml +++ b/all-is-cubes-port/Cargo.toml @@ -75,7 +75,7 @@ stl_io = { version = "0.8.1", optional = true } serde_json = { workspace = true, optional = true } # glTF related dependencies -base64 = { workspace = true, optional = true } +base64 = { workspace = true, optional = true, features = ["alloc"] } bytemuck = { workspace = true, optional = true, features = ["derive"] } # gltf-json often has semver-incompatible changes, so pin it gltf-json = { version = ">=1.4.1, <1.5.0", optional = true, default-features = false, features = ["names", "KHR_materials_volume", "KHR_materials_transmission"] } diff --git a/all-is-cubes-port/src/export.rs b/all-is-cubes-port/src/export.rs index 180f9902c..6944dded6 100644 --- a/all-is-cubes-port/src/export.rs +++ b/all-is-cubes-port/src/export.rs @@ -1,4 +1,4 @@ -use std::ffi::OsString; +#[allow(unused_imports)] use std::path::{Path, PathBuf}; #[allow(unused_imports)] use std::{fs, io}; @@ -91,6 +91,7 @@ impl ExportSet { /// This has a suffix added for uniqueness (after the name but preserving the existing /// extension), based on the item's [`Handle::name()`], if the [`ExportSet`] contains more /// than one item. If it contains only one item, then `base_path` is returned unchanged. + #[cfg(feature = "stl")] // stl is the only exporter that does multi-file pub(crate) fn member_export_path( &self, base_path: &Path, @@ -98,7 +99,7 @@ impl ExportSet { ) -> PathBuf { let mut path: PathBuf = base_path.to_owned(); if self.contents.count() > 1 { - let mut new_file_name: OsString = + let mut new_file_name: std::ffi::OsString = base_path.file_stem().expect("file name missing").to_owned(); new_file_name.push("-"); match member.name() {