Skip to content

Code detecting existence of template doesn’t work #43

@flying-sheep

Description

@flying-sheep

I created a readable plain text file, selected it as template, but still the else branch is hit here:

QFile templateFile(templateFileName);
#ifdef KTIKZ_USE_KDE
KFileItem templateFileItem(QUrl::fromLocalFile(templateFileName));
if (templateFileItem.determineMimeType().parentMimeTypes().contains(QLatin1String("text/plain"))
#else
if (QFileInfo(templateFile).isFile()
#endif
&& templateFile.open(QIODevice::ReadOnly | QIODevice::Text) // if user-specified template file is readable
&& !tikzReplaceText.isEmpty())
{

If I output the mime list, I get just ("application/octet-stream"), while I also get

$ file --mime-type Dev/TeX/ktikz-context.pgs
Dev/TeX/ktikz-context.pgs: text/plain

I assume if the file itself has the text/plain mime already, its parents only contain application/octet-stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions