MCPcopy Create free account
hub / github.com/Martchus/tageditor / openFile

Method openFile

cli/scriptapi.cpp:137–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137QJSValue UtilityObject::openFile(const QString &path)
138{
139 if (!m_diag) {
140 return QJSValue();
141 }
142 auto mediaFileInfo = std::make_unique<TagParser::MediaFileInfo>(path.toStdString());
143 auto feedback = TagParser::AbortableProgressFeedback();
144 try {
145 mediaFileInfo->open(true);
146 mediaFileInfo->parseEverything(*m_diag, feedback);
147 } catch (const std::exception &e) {
148 m_diag->emplace_back(TagParser::DiagLevel::Critical, CppUtilities::argsToString("Unable to open \"", mediaFileInfo->path(), "\": ", e.what()),
149 m_context ? *m_context : s_defaultContext);
150 return QJSValue();
151 }
152 auto mediaFileInfoObj = new MediaFileInfoObject(std::move(mediaFileInfo), *m_diag, m_engine, false, m_engine);
153 return m_engine->newQObject(mediaFileInfoObj);
154}
155
156QJSValue UtilityObject::runProcess(const QString &path, const QJSValue &args, int timeout)
157{

Callers 1

openOriginalFileFunction · 0.80

Calls 2

pathMethod · 0.80

Tested by

no test coverage detected