How To Resolve A File Path?
In a Python script I'd like to be able to take a path and resolve it so I can use editor.get_file_contents() for it.
I can use get_selected_folder() for the first and this works well - concatenating /metadata.md to the path returned and using the root.
How do I do more complicated cases such as the second? Do I individually look for ./ and ../ and manipulate the path from there?
Any ideas? This must be a pretty standard thing to do.
Thanks @ccc. And that resolves eg ../ to "parent directory" ?
And I suspect os.curdir isn't the directory I want. In my use case I want it to be relative to the document in the frame. Hence my use of get_selected_folder.
With that adjustment I tested successfully with ./metadata.md.
So thanks again @ccc.
os.curdir == '.'
os.pardir == '..'