I try to create a configuration class for my plugin, that gathers information from the package, the workspace/project and a configuration file in the project directory. Now I can’t figure out how to get the path to that file.
The list of folders in the workspace/project settings are relative (~/path/to/project) so I am struggling to get an absolute path so I can check if the file exists and read it.
Here is what I have so far:
project_configuration_file = sublime.active_window().project_data()["folders"]["path"] project_configuration_file = Path(project_configuration_file).resolve() print(project_configuration_file)
But I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/sublime_text/~'
It looks like python is resolving the relative path very wrong …
Can some one tell me how to handle this?