File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99#include " mainframe/projecttree.h"
1010#include " mainframe/recent/recentopenwidget.h"
1111#include " common/common.h"
12+ #include " common/util/macroexpander.h"
1213#include " base/abstractmenu.h"
1314#include " base/abstractaction.h"
1415#include " base/abstractwidget.h"
@@ -81,6 +82,7 @@ bool ProjectCore::start()
8182
8283 initProject (ctx);
8384 initLocator (ctx);
85+ registerVariables ();
8486
8587 return true ;
8688}
@@ -219,6 +221,16 @@ void ProjectCore::initProject(dpf::PluginServiceContext &ctx)
219221 }
220222}
221223
224+ void ProjectCore::registerVariables ()
225+ {
226+ globalMacroExpander ()->registerFileVariables (" CurrentProject" ,
227+ tr (" Current project" ),
228+ [] {
229+ auto info = ProjectKeeper::instance ()->treeView ()->getActiveProjectInfo ();
230+ return QFileInfo (info.workspaceFolder ());
231+ });
232+ }
233+
222234dpf::Plugin::ShutdownFlag ProjectCore::stop ()
223235{
224236 qInfo () << __FUNCTION__;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class ProjectCore : public dpf::Plugin
2828
2929 void initLocator (dpf::PluginServiceContext& ctx);
3030 void initProject (dpf::PluginServiceContext& ctx);
31+ void registerVariables ();
3132
3233private slots:
3334 void pluginsStartedMain ();
You can’t perform that action at this time.
0 commit comments