16#include <CoreFoundation/CoreFoundation.h>
33 QString localFileQString = url.toLocalFile();
35 if (localFileQString.startsWith(
"/.file/id=")) {
36 CFStringRef relCFStringRef =
37 CFStringCreateWithCString(kCFAllocatorDefault, localFileQString.toUtf8().constData(), kCFStringEncodingUTF8);
38 CFURLRef relCFURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, relCFStringRef, kCFURLPOSIXPathStyle,
41 CFErrorRef
error =
nullptr;
42 CFURLRef absCFURL = CFURLCreateFilePathURL(kCFAllocatorDefault, relCFURL, &
error);
44 static const CFIndex maxAbsPathCStrBufLen = 4096;
45 char absPathCStr[maxAbsPathCStrBufLen];
46 if (CFURLGetFileSystemRepresentation(absCFURL,
48 reinterpret_cast<UInt8 *
>(&absPathCStr[0]), maxAbsPathCStrBufLen)) {
49 localFileQString = QString(absPathCStr);
54 CFRelease(relCFStringRef);
56 return QUrl(localFileQString);
71 QStringList filenames;
72 const auto mimeData =
event->mimeData();
73 if (mimeData->hasUrls()) {
74 const auto urlList = mimeData->urls();
75 for (
const auto &url : urlList) {
77 const auto fName = fileUrl.toLocalFile();
78 if (fName.size() > 0) {
79 filenames.append(fName);
95 QStringList filenames;
100 if (fi.suffix().toUpper() ==
"PY") {
101 filenames.append(name);
QUrl fixupURL(const QUrl &url)
Workaround for file path bug on OSX >=10.10 with Qt4.