eclipse-archived / ceylon-sdk

Standard platform modules belonging to the Ceylon SDK
http://www.ceylon-lang.org
Apache License 2.0
72 stars 60 forks source link

Add conversion between Path and Uri #101

Open akberc opened 11 years ago

akberc commented 11 years ago

We should be able to turn a Path into a Uri and vice-versa. We need to take special care for Windows platforms and the drive roots.

FroMage commented 11 years ago

Well, C:\Users\x\git\x\x\config is not a valid URI, so you can't parse it as one.

akberc commented 11 years ago

OK. Makes sense. I should add a scheme.

A scheme plus a path should result in a URI, but is there a quick way to convert the path segments and separators?

FroMage commented 11 years ago

You should add a scheme and turn it into a URI: file:///c:/Users/x/git/x/x/config.

I guess we need to add a way to convert paths to URIs in the SDK.

FroMage commented 11 years ago

If you're OK I'll edit this issue to reflect the fact that we're missing a feature?

akberc commented 11 years ago

Thank, please do.

Adding a scheme to a normalized (not platform specific) path should result in a URI.

And hopefully, if a scheme is not provided, it should choose the JVM default filesystem scheme.

akberc commented 11 years ago

With the existing uriString, works fine as below.

variable String configURI = getBootProperty("config.store",xHome.absolutePath.childPath("config").uriString);
configURI = configURI.replace("{x.home}", xHome.uriString);