Open ForNeVeR opened 2 months ago
Hi. I apologize for the long silence and delay. If no one else has done it, can I take it to work?
Of course, feel free to take this one.
I'd like to ask a couple of clarifying questions about the task:
Regarding the prohibition of absolute paths: Should an exception be thrown if such paths (like /.. for Unix or X:.. for Windows) are detected in the AbsolutePath constructor?
So there should be the same behavior for: AbsolutePath(“smth”) / new RelativePath(“...”)
and vice versa? An exception should be thrown?
- Regarding the prohibition of absolute paths: Should an exception be thrown if such paths (like /.. for Unix or X:.. for Windows) are detected in the AbsolutePath constructor?
Yes. If a path is impossible to represent as an absolute one, then let's throw an exception.
- So there should be the same behavior for:
AbsolutePath(“smth”) / new RelativePath(“...”)
and vice versa? An exception should be thrown?
Same behavior as with new AbsolutePath("smth")
, yes. And I think you mean new LocalPath
and not new RelativePath
? For now I think let's not touch that one. I am not yet sure if we want the same restrictions about incorrect absolute paths to apply to the LocalPath
. Probably not.
Absolute paths such as
/..
(Unix) orX:\..
(Windows) should be forbidden. Let's add the corresponding validation into theAbsolutePath
constructor.Also check the behavior of
new AbsolutePath("smth") / new RelativePath("..")
— it should be the same w.r.t. the exceptions thrown.