From 4ba9879b2694ee6288ba466fb7f41642b94829e1 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 18 Jul 2025 13:26:21 +0800 Subject: [PATCH 01/10] mimeutils: fix for macOS --- libfm/mimeutils.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git libfm/mimeutils.cpp libfm/mimeutils.cpp index 5c883ea..eec9818 100644 --- libfm/mimeutils.cpp +++ libfm/mimeutils.cpp @@ -93,13 +93,25 @@ void MimeUtils::openInApp(const QFileInfo &file, QString termCmd) { openInApp(df.getExec(), file, termCmd); } else { #ifdef Q_OS_DARWIN - CFURLRef ref = CFURLCreateWithFileSystemPath(Q_NULLPTR, - file.absoluteFilePath().toCFString(), - kCFURLPOSIXPathStyle, - file.isDir()); - LSOpenCFURLRef(ref, Q_NULLPTR); + QString path = file.absoluteFilePath(); + CFStringRef cfPath = CFStringCreateWithCString( + Q_NULLPTR, + path.toUtf8().constData(), + kCFStringEncodingUTF8 + ); + + CFURLRef ref = CFURLCreateWithFileSystemPath( + Q_NULLPTR, + cfPath, + kCFURLPOSIXPathStyle, + file.isDir() + ); + + LSOpenCFURLRef(ref, Q_NULLPTR); + + CFRelease(ref); + CFRelease(cfPath); #else - QString title = tr("No default application"); QString msg = tr("No default application for mime: %1!").arg(mime); QMessageBox::warning(Q_NULLPTR, title, msg); -- 2.49.0