![]() |
|
How to get the full path from a GFile - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: How to get the full path from a GFile (/Thread-How-to-get-the-full-path-from-a-GFile) |
How to get the full path from a GFile - nmw01223 - 01-21-2026 Development on Windows 11 using python 3 in Gimp 3.0.6. I can find no way of getting the path from a GFile returned from the parameter setting dialog in a plugin. A file parameter is created by Code: procedure.add_file_argument("src-folder",The parameter is then obtained after the dialog has run as Code: src_gfile = config.get_property("src-folder")I've tried various things - src_gfile.get_path() produced nothing (though in another plugin I looked at it clearly did looking at the code, but that may have been on Linux, not Windows). I did find that if in the python console I create a GFile and get the path as Code: file = Gio.File.new_for_path("C:\\a\\b\\c")src_gfile.get_uri() does produce the URI as a string, looking something line 'file:\\\C:\a\b\c'. Being a URI, it has the scheme on the from, and I can lose the 'file:\\\' by editing the string, but can't help feeling that is a bodge, certainly not cross platform. I then found query_info(). So I tried Code: file_info = src_gfile.query_info("standard::*", Gio.FileQueryInfoFlags.NONE, None)So, basically, I can find no way of tidily get the full path as a string from a GFile. Can anyone help? |