From 0efc818635ce4701280a99447350918c29d40752 Mon Sep 17 00:00:00 2001 From: WenTao Date: Wed, 3 Sep 2025 15:25:08 +0800 Subject: [PATCH] Fix Windows path separator issue using PathBuf (#482) * Update mod.rs The following code uses a separator that is not compatible with Windows: format!("{}/{}", file_config.path.clone(), rustfs_config::DEFAULT_SINK_FILE_LOG_FILE) Change it to the following code: std::path::Path::new(&file_config.path) .join(rustfs_config::DEFAULT_SINK_FILE_LOG_FILE) .to_string_lossy() .to_string() * Replaced format! macro with PathBuf::join to fix path separator issue on Windows.Tested on Windows 10 with Rust 1.85.0, paths now correctly use \ separator. --- crates/obs/src/sinks/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/obs/src/sinks/mod.rs b/crates/obs/src/sinks/mod.rs index 212607a69..71d84ac49 100644 --- a/crates/obs/src/sinks/mod.rs +++ b/crates/obs/src/sinks/mod.rs @@ -79,7 +79,10 @@ pub async fn create_sinks(config: &AppConfig) -> Vec> { SinkConfig::File(file_config) => { tracing::debug!("FileSink: Using path: {}", file_config.path); match file::FileSink::new( - format!("{}/{}", file_config.path.clone(), rustfs_config::DEFAULT_SINK_FILE_LOG_FILE), + std::path::Path::new(&file_config.path) + .join(rustfs_config::DEFAULT_SINK_FILE_LOG_FILE) + .to_string_lossy() + .to_string(), file_config .buffer_size .unwrap_or(rustfs_config::observability::DEFAULT_SINKS_FILE_BUFFER_SIZE),