unvt / charites

It is an application to style vector tiles easily
https://unvt.github.io/charites/
MIT License
54 stars 13 forks source link

Support slash in layer ID #121

Closed keichan34 closed 1 year ago

keichan34 commented 1 year ago

Description

Fix #56 by creating directories recursively after joining the layers directory with the layer ID. Before this fix, the layers directory was being created, but if the ID contained a slash, it would try to write the file to an nonexistent directory, resulting in an error.

Type of Pull Request

Verify the followings

Refer to CONTRIBUTING.MD for more details.

hfu commented 1 year ago

I like this implementation although I am not really sure this works perfectly in Windows environments ;-)

keichan34 commented 1 year ago

@hfu Ah, that's a good point. If the name of the file isn't stable between UNIX and Windows operating systems, charites projects won't be able to shared between them. I'll double check what happens on Windows and make fixes as necessary. Thanks!

ubukawa commented 1 year ago

Just for your information. I tried this on a docker container. This is really wonderful. We can beautifully import JSON style into a series of sub-directory. https://github.com/ubukawa/cmv-test/tree/main/esri/layers

We can have a long name for a style layer. When building a JSON style, I found that there would be an error if we use ">(「折り返し形式のブロックスカラー」)" in the layers where we use "!!inc/file" image

I wonder we may need to avoid using ">". This is not directly related to this PR, I will share it at issue.]