Comments (5)
I just wanted to add that the current path handling code in Ceylon jumps numerous times back and forth between File and String while working with paths. This is exactly the use case that Path was created for.
You will find basePath.resolve(relativeOrAbsolutePath)
useful too, it does a lot of work that is re-implemented in several places in the Ceylon code.
If you want to add the ability to resolve file://
URLs as paths, you need to do some trickier things to get correct Windows support while handling possibly-broken mixes of file://
URLs and system-dependent path formats. The correct recipe is:
basePath.resolve(Paths.get(new URL(pathStr).toURI())).toRealPath(LinkOption.NOFOLLOW_LINKS)
i.e. the recommended way of handling file://
URLs is to convert from URL
-> URI
-> Path
. (Reference 1) ; (Reference 2)
from ceylon-compiler.
I just realized my own project FastClasspathScanner has this same bug, where it resolved symlinks, and then tried to resolve paths relative to each other while expecting that the paths had not jumped to somewhere else in the file hierarchy. (Had to add NOFOLLOW_LINKS there.)
from ceylon-compiler.
Thanks for the inf Luke!
from ceylon-compiler.
I should add that you need to search the source for both "CanonicalPath" and "CanonicalFile" to find all the places that need to have symlink resolution removed. It was only about a dozen changes, last time I looked.
Switching the source loader and the module loader APIs to use Path objects rather than String or File objects should help find a lot of the places in the code that could be switched to using Path (in order to remove the duplicated code for doing Path.resolve() and related operations, and to make path handling uniform).
from ceylon-compiler.
@lukehutch deprecated repository ;)
from ceylon-compiler.
Related Issues (20)
- Ceylon backend error on generic function combined with other generic function
- File is not in the current source path HOT 30
- cannot narrow `empty`
- interface method cannot have defaulted type parameter
- "ceylon run --compile" does not recompile changes HOT 3
- No .src provided HOT 2
- assert fails for sequence type HOT 8
- incompatible types with if expression
- Can't override a Java method that uses raw types
- Module collision betweeen 1.2.0 and 1.2.1 ceylon.test when running tests JVM tests from 1.2.0 HOT 8
- ceylon test: inspect the tested module to determine version of the test framework to load HOT 3
- Java meta-annotation not supported HOT 1
- Metamodel refs to bootstrap modules HOT 2
- ceylon war tool should be able to package .js files from a Ceylon module HOT 1
- destructure in initializer results in "cannot find symbol"
- While trying to run compiler unit tests, got "java.lang.NoClassDefFoundError: Could not initialize class com.redhat.ceylon.compiler.java.test.CompilerTests"
- Flow typing glitch HOT 1
- compiler bug: visitor didn't yield any result HOT 1
- Cannot find module artificat from remote maven repository HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ceylon-compiler.