Replacement for KMimeType::isBinaryData?
David Faure
faure at kde.org
Mon Jan 5 14:04:48 UTC 2015
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.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list