From 158ad8a7308c162a8f859bc73565edb6f9db1429 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 19 Sep 2023 15:59:44 +0100 Subject: [PATCH] Disable symlink content paths on Unix as Steamworks doesn't recognise them --- fastgmad-bin/src/main.rs | 2 ++ fastgmad-lib/src/lib.rs | 1 + fastgmad-lib/src/workshop/mod.rs | 16 ++++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fastgmad-bin/src/main.rs b/fastgmad-bin/src/main.rs index 48de5b6..deb9431 100644 --- a/fastgmad-bin/src/main.rs +++ b/fastgmad-bin/src/main.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unnecessary_literal_unwrap)] + use fastgmad::{ bin_prelude::*, create::{CreateGmaConfig, CreateGmadOut}, diff --git a/fastgmad-lib/src/lib.rs b/fastgmad-lib/src/lib.rs index faac4c7..e0e8ca6 100644 --- a/fastgmad-lib/src/lib.rs +++ b/fastgmad-lib/src/lib.rs @@ -7,6 +7,7 @@ //! `binary` - Recommended if you're using fastgmad in a binary as this enables some binary-related helpers. #![cfg_attr(not(feature = "binary"), warn(missing_docs))] +#![allow(clippy::unnecessary_literal_unwrap)] const GMA_MAGIC: &[u8] = b"GMAD"; const GMA_VERSION: u8 = 3; diff --git a/fastgmad-lib/src/workshop/mod.rs b/fastgmad-lib/src/workshop/mod.rs index 011369e..d623a48 100644 --- a/fastgmad-lib/src/workshop/mod.rs +++ b/fastgmad-lib/src/workshop/mod.rs @@ -227,7 +227,7 @@ fn workshop_upload(#[cfg(feature = "binary")] noprogress: bool, kind: PublishKin // Add "Addon" and the addon type to the tags let tags = { - let mut tags = BTreeSet::from_iter(metadata.tags.into_iter()); + let mut tags = BTreeSet::from_iter(metadata.tags); tags.insert("Addon".to_string()); @@ -389,7 +389,7 @@ impl ContentPath { let temp_gma_path = dir.join("fastgmad.gma"); - let symlink_result = { + let symlink_result: Result<(), FastGmadError> = { #[cfg(windows)] { let res = std::os::windows::fs::symlink_file(gma_path, &temp_gma_path); @@ -401,16 +401,20 @@ impl ContentPath { } res } + + /* + Steamworks doesn't recognise symlinks on Unix :< + #[cfg(unix)] { std::os::unix::fs::symlink(gma_path, &temp_gma_path) } #[cfg(not(any(windows, unix)))] + */ + + #[cfg(not(windows))] { - Err(FastGmadError::IoError(std::io::Error::new( - std::io::ErrorKind::Other, - "Unsupported platform", - ))) + Err(fastgmad_io_error!(error: std::io::Error::from(std::io::ErrorKind::Unsupported))) } };