Accessing Current Project Path in Plugin UI


I’m developing a plugin for Shotcut, and that plugin needs to read and write to a file. I’d like to be able to store the path to that file as a path that is relative to the “current project” (if one exists) so that the project file and folder can be moved / renamed / etc. without the path reference becoming out of date.

So far I haven’t found any way to get any such value. Does it exist or should I just store the full path?

Look at qml/filters/stabilize/ui.qml:

                var filename = application.getNextProjectFile('stab')
                if (filename) {
                } else {

'stab' is the filename extension that you want to use. The function getNextProjectFile() creates a filename with an automatically incremented number plus your extension if the user is using a project folder, which is optional.

Thank you, but it doesn’t quite do what I want. I need something that returns c:\mydir when I have c:\mydir\myfile.mlt open, so I can store paths relative to the project the plugin instance is in. (Or it could return c:\mydir\myfile.mlt, that’s OK too.)

What you want is not supported. You cannot assume the directory to use unless there is a project folder. Otherwise, you need to give a button and use a file dialog to let the user choose the location.

1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.