java - How to check if a file path is relative to another file path? -
if have path:
string path = "/some/path"
how can check if other paths relative (given going concatenate 'anotherpath' onto 'path')?
for example:
string anotherpath = ""; // relative = true // result in full path of "/some/path" string anotherpath = "/some/more"; // relative = true // result in full path of "/some/path/some/more" string anotherpath = "some/more"; // relative = true // result in full path of "/some/path/some/more" string anotherpath = "../../trying/go/up"; // relative = false // result in invalid full path of "/trying/go/up" string anotherpath = "../more"; // relative = true // result in full path of "/some/more"
also, possible these checks using strings rather file or url objects? (as not able write filesystem)
Comments
Post a Comment