From 7aff8cdd2e556f00e82975a2322232803e665d6a Mon Sep 17 00:00:00 2001 From: Yuji Mise Date: Fri, 4 Oct 2024 13:59:28 +0900 Subject: [PATCH] feat(engine): update path handling to use platform-independent spearator (#551) * feat(engine): update path handling to use platform-independent separators * fix * bump up --- engine/Cargo.lock | 38 +++++++++---------- engine/Cargo.toml | 2 +- .../plateau-gis-quality-checker/package.json | 2 +- .../src-tauri/tauri.conf.json | 2 +- .../src/udx_folder_extractor.rs | 22 +++++++---- .../action-source/src/file/path_extractor.rs | 9 ++++- 6 files changed, 44 insertions(+), 31 deletions(-) diff --git a/engine/Cargo.lock b/engine/Cargo.lock index a869df64c..165ec88e0 100644 --- a/engine/Cargo.lock +++ b/engine/Cargo.lock @@ -4204,7 +4204,7 @@ dependencies = [ [[package]] name = "reearth-flow-action-log" -version = "0.0.1" +version = "0.0.2" dependencies = [ "futures", "once_cell", @@ -4224,7 +4224,7 @@ dependencies = [ [[package]] name = "reearth-flow-action-plateau-processor" -version = "0.0.1" +version = "0.0.2" dependencies = [ "approx", "async-trait", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "reearth-flow-action-processor" -version = "0.0.1" +version = "0.0.2" dependencies = [ "Inflector", "approx", @@ -4302,7 +4302,7 @@ dependencies = [ [[package]] name = "reearth-flow-action-sink" -version = "0.0.1" +version = "0.0.2" dependencies = [ "ahash 0.8.11", "async-trait", @@ -4350,7 +4350,7 @@ dependencies = [ [[package]] name = "reearth-flow-action-source" -version = "0.0.1" +version = "0.0.2" dependencies = [ "async-trait", "async_zip", @@ -4384,7 +4384,7 @@ dependencies = [ [[package]] name = "reearth-flow-cli" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bytes", "clap", @@ -4419,7 +4419,7 @@ dependencies = [ [[package]] name = "reearth-flow-common" -version = "0.0.1" +version = "0.0.2" dependencies = [ "approx", "async-recursion", @@ -4449,7 +4449,7 @@ dependencies = [ [[package]] name = "reearth-flow-eval-expr" -version = "0.0.1" +version = "0.0.2" dependencies = [ "futures", "reearth-flow-common", @@ -4462,7 +4462,7 @@ dependencies = [ [[package]] name = "reearth-flow-examples" -version = "0.0.1" +version = "0.0.2" dependencies = [ "async-trait", "bytes", @@ -4490,7 +4490,7 @@ dependencies = [ [[package]] name = "reearth-flow-geometry" -version = "0.0.1" +version = "0.0.2" dependencies = [ "approx", "bytes", @@ -4515,7 +4515,7 @@ dependencies = [ [[package]] name = "reearth-flow-macros" -version = "0.0.1" +version = "0.0.2" dependencies = [ "proc-macro2", "quote", @@ -4524,7 +4524,7 @@ dependencies = [ [[package]] name = "reearth-flow-runner" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bytes", "crossbeam", @@ -4552,7 +4552,7 @@ dependencies = [ [[package]] name = "reearth-flow-runtime" -version = "0.0.1" +version = "0.0.2" dependencies = [ "async-stream", "async-trait", @@ -4585,7 +4585,7 @@ dependencies = [ [[package]] name = "reearth-flow-state" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bytes", "reearth-flow-common", @@ -4599,7 +4599,7 @@ dependencies = [ [[package]] name = "reearth-flow-storage" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bytes", "futures", @@ -4617,7 +4617,7 @@ dependencies = [ [[package]] name = "reearth-flow-telemetry" -version = "0.0.1" +version = "0.0.2" dependencies = [ "once_cell", "opentelemetry", @@ -4631,7 +4631,7 @@ dependencies = [ [[package]] name = "reearth-flow-tests" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bytes", "directories", @@ -4656,7 +4656,7 @@ dependencies = [ [[package]] name = "reearth-flow-types" -version = "0.0.1" +version = "0.0.2" dependencies = [ "ahash 0.8.11", "bytes", @@ -4692,7 +4692,7 @@ dependencies = [ [[package]] name = "reearth-flow-worker" -version = "0.0.1" +version = "0.0.2" dependencies = [ "once_cell", "reearth-flow-action-log", diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 3c179eb3e..0a60b98d5 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -18,7 +18,7 @@ homepage = "https://github.com/reearth/reearth-flow" license = "MIT OR Apache-2.0" repository = "https://github.com/reearth/reearth-flow" rust-version = "1.81" # Remember to update clippy.toml as well -version = "0.0.1" +version = "0.0.2" [profile.dev] opt-level = 0 diff --git a/engine/plateau-gis-quality-checker/package.json b/engine/plateau-gis-quality-checker/package.json index 935d2a202..f966aae1a 100644 --- a/engine/plateau-gis-quality-checker/package.json +++ b/engine/plateau-gis-quality-checker/package.json @@ -1,6 +1,6 @@ { "name": "plateau-gis-quality-checker", - "version": "0.0.1", + "version": "0.0.2", "repository": "https://github.com/reearth/reearth-flow.git", "license": "APACHE-2.0", "type": "module", diff --git a/engine/plateau-gis-quality-checker/src-tauri/tauri.conf.json b/engine/plateau-gis-quality-checker/src-tauri/tauri.conf.json index aac0dd2d1..4839d3e3b 100644 --- a/engine/plateau-gis-quality-checker/src-tauri/tauri.conf.json +++ b/engine/plateau-gis-quality-checker/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "PLATEAU GIS Quality Checker", - "version": "0.0.1" + "version": "0.0.2" }, "tauri": { "allowlist": { diff --git a/engine/runtime/action-plateau-processor/src/udx_folder_extractor.rs b/engine/runtime/action-plateau-processor/src/udx_folder_extractor.rs index 2ccaa3084..7e5fd1f9e 100644 --- a/engine/runtime/action-plateau-processor/src/udx_folder_extractor.rs +++ b/engine/runtime/action-plateau-processor/src/udx_folder_extractor.rs @@ -1,4 +1,9 @@ -use std::{collections::HashMap, path::PathBuf, str::FromStr, sync::Arc}; +use std::{ + collections::HashMap, + path::{PathBuf, MAIN_SEPARATOR, MAIN_SEPARATOR_STR}, + str::FromStr, + sync::Arc, +}; use reearth_flow_common::uri::Uri; use reearth_flow_runtime::{ @@ -194,7 +199,7 @@ fn mapper( .map_err(|e| PlateauProcessorError::UdxFolderExtractor(format!("{:?}", e)))? }; let folders = city_gml_path - .split('/') + .split(MAIN_SEPARATOR) .map(String::from) .collect::>(); let city_gml_path = Uri::from_str(city_gml_path.to_string().as_str()) @@ -214,7 +219,7 @@ fn mapper( root = fourth_last.to_string(); pkg = second_last.to_string(); dirs = second_last.to_string(); - rtdir = PathBuf::from(folders[..folders.len() - 3].join("/")); + rtdir = PathBuf::from(folders[..folders.len() - 3].join(MAIN_SEPARATOR_STR)); } [.., fifth_last, _fourth_last, third_last, second_last, _last] if PKG_FOLDERS.contains(&third_last.as_str()) => @@ -222,8 +227,8 @@ fn mapper( root = fifth_last.to_string(); pkg = third_last.to_string(); area = second_last.to_string(); - dirs = format!("{}/{}", pkg, area); - rtdir = PathBuf::from(folders[..folders.len() - 4].join("/")); + dirs = format!("{}{}{}", pkg, MAIN_SEPARATOR_STR, area); + rtdir = PathBuf::from(folders[..folders.len() - 4].join(MAIN_SEPARATOR_STR)); } [.., sixth_last, _fifth_last, fourth_last, third_last, second_last, _last] if PKG_FOLDERS.contains(&fourth_last.as_str()) => @@ -232,8 +237,11 @@ fn mapper( pkg = fourth_last.to_string(); admin = third_last.to_string(); area = second_last.to_string(); - dirs = format!("{}/{}/{}", pkg, admin, area); - rtdir = PathBuf::from(folders[..folders.len() - 5].join("/")); + dirs = format!( + "{}{}{}{}{}", + pkg, MAIN_SEPARATOR_STR, admin, MAIN_SEPARATOR_STR, area + ); + rtdir = PathBuf::from(folders[..folders.len() - 5].join(MAIN_SEPARATOR_STR)); } _ => (), }; diff --git a/engine/runtime/action-source/src/file/path_extractor.rs b/engine/runtime/action-source/src/file/path_extractor.rs index 76fb34733..68af238bd 100644 --- a/engine/runtime/action-source/src/file/path_extractor.rs +++ b/engine/runtime/action-source/src/file/path_extractor.rs @@ -1,4 +1,9 @@ -use std::{collections::HashMap, path::Path, str::FromStr, sync::Arc}; +use std::{ + collections::HashMap, + path::{Path, MAIN_SEPARATOR}, + str::FromStr, + sync::Arc, +}; use async_zip::base::read::mem::ZipFileReader; use futures::AsyncReadExt; @@ -120,7 +125,7 @@ pub async fn extract( { continue; } - let entry_is_dir = filename.ends_with('/'); + let entry_is_dir = filename.ends_with(MAIN_SEPARATOR); if entry_is_dir { if storage .exists(outpath.path().as_path())