Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(engine): enhance URI path handling with dynamic separator support #552

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ graphs:
with:
format: tsv
output: |
file::join_path(file::join_path(env.get("outputPath"), env.get("__value").destDataset), "不正な面の向きエラー.tsv")
file::join_path(env.get("outputPath"), "不正な面の向きエラー.tsv")
miseyu marked this conversation as resolved.
Show resolved Hide resolved
- id: 0c30b482-b241-4d47-9a88-175c5f98ff8d
name: AttributeMapperInvalidSurface
type: action
Expand Down Expand Up @@ -783,7 +783,7 @@ graphs:
with:
format: tsv
output: |
file::join_path(file::join_path(env.get("outputPath"), env.get("__value").destDataset), "不正な面エラー.tsv")
file::join_path(env.get("outputPath"), "不正な面エラー.tsv")
miseyu marked this conversation as resolved.
Show resolved Hide resolved
- id: e51e64b4-6cc0-4698-b677-e5f7f667f24f
name: FeatureMerger
type: action
Expand Down
4 changes: 0 additions & 4 deletions engine/plateau-gis-quality-checker/src-tauri/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ pub(crate) struct QualityCheckWorkflow {

pub(crate) static QUALITY_CHECK_WORKFLOWS: Lazy<Vec<QualityCheckWorkflow>> = Lazy::new(|| {
vec![
QualityCheckWorkflow {
id: "common".to_string(),
name: "共通".to_string(),
},
QualityCheckWorkflow {
id: "tran-rwy-trk-squr-wwy".to_string(),
name: "道路".to_string(),
Expand Down
38 changes: 27 additions & 11 deletions engine/runtime/common/src/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ pub struct Uri {
}

impl Uri {
pub fn separator(&self) -> String {
let sep = self.protocol.separator();
sep.to_string()
}
miseyu marked this conversation as resolved.
Show resolved Hide resolved

pub fn for_test(uri: &str) -> Self {
Self::from_str(uri).unwrap()
}
Expand Down Expand Up @@ -157,16 +162,27 @@ impl Uri {

pub fn path(&self) -> PathBuf {
let p = &self.uri[self.protocol.as_str().len() + PROTOCOL_SEPARATOR.len()..];
let sub_path = p
.split(self.protocol.separator())
.skip(1)
.collect::<Vec<&str>>()
.join("/")
.to_string();
if self.is_dir() {
PathBuf::from(format!("/{}/", sub_path))
} else {
PathBuf::from(format!("/{}", sub_path))
match self.protocol {
Protocol::Google | Protocol::Http | Protocol::Https => PathBuf::from(format!(
"{}{}",
self.separator().as_str(),
p.split(self.protocol.separator())
.skip(1)
.collect::<Vec<&str>>()
.join(self.separator().as_str())
)),
Protocol::File | Protocol::Ram => {
let sub_path = p
.split(self.protocol.separator())
.collect::<Vec<&str>>()
.join(self.separator().as_str())
.to_string();
if self.is_dir() {
PathBuf::from(format!("{}{}", sub_path, self.separator().as_str()))
} else {
PathBuf::from(sub_path)
}
}
miseyu marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -609,7 +625,7 @@ mod tests {
#[test]
fn test_sub_path() {
assert_eq!(
Uri::for_test("file:///foo/hoge")._path(),
Uri::for_test("file:///foo/hoge").path(),
miseyu marked this conversation as resolved.
Show resolved Hide resolved
PathBuf::from_str("/foo/hoge").unwrap()
);
assert_eq!(
Expand Down