Replacement for KMimeType::isBinaryData?

Kevin Funk kfunk at kde.org
Mon Jan 5 14:48:07 UTC 2015


On Monday 05 January 2015 15:04:48 David Faure wrote:
> On Monday 05 January 2015 12:39:36 Milian Wolff wrote:
> > In KDevelop, we support file/project templates. These are archives of
> > files
> > that may contain placeholders that will get replaced with user input when
> > a
> > file/project is created from a template. This replacement can only work on
> > non-binary data, which is what the code checked in KDE4 times. In slightly
> > abbreviated code:
> > 
> > AppWizardPlugin::copyFileAndExpandMacros(sourceFile, destFile)
> > {
> > 
> >   if (isBinaryData(source)) {
> >   
> >     KIO::copy(source, dest);
> >   
> >   } else {
> >   
> >     destFile << expandMacros(sourceFile);
> >   
> >   }
> > 
> > }
> 
> I see.
> 
> > You have more knowledge about mimetypes than us. Can we maybe just check
> > whether the mimetype of sourceFile inherits text/plain?
> 
> Excellent idea. This would go a long way indeed.
> 
> I tried to find if this wouldn't work for some mimetypes, but I can't find
> an example - it seems that it would indeed work just fine.

+1

Can you go ahead and remove our copy of isBinaryData in kdevplatform.git then?

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org


More information about the Kde-frameworks-devel mailing list