diff --git a/src/utils/vmetawordmanager.cpp b/src/utils/vmetawordmanager.cpp index 6d1a9703..cccf781e 100644 --- a/src/utils/vmetawordmanager.cpp +++ b/src/utils/vmetawordmanager.cpp @@ -8,6 +8,8 @@ #include "vconfigmanager.h" #include "vmainwindow.h" +#include "vnotefile.h" +#include "vnotebook.h" extern VConfigManager *g_config; @@ -280,6 +282,25 @@ void VMetaWordManager::init() return QString(); }); + // %att%. + addMetaWord(MetaWordType::FunctionBased, + "att", + tr("relative path of current note's attachment folder"), + [](const VMetaWord *) { + const VFile *file = g_mainWin->getCurrentFile(); + if (file && file->getType() == FileType::Note) { + const VNoteFile *nfile = static_cast(file); + const QString &folder = nfile->getAttachmentFolder(); + if (!folder.isEmpty()) { + return nfile->getNotebook()->getAttachmentFolder() + + "/" + + folder; + } + } + + return QString(); + }); + // Custom meta words. initCustomMetaWords();