Skip to content

Commit a0dceb1

Browse files
committedSep 17, 2018
[layouts] Fix messagebar link with special characters does not open on win
Fixes #19727
1 parent d37a799 commit a0dceb1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎src/native/win/qgswinnative.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,19 @@ void QgsWinNative::cleanup()
6868
void QgsWinNative::openFileExplorerAndSelectFile( const QString &path )
6969
{
7070
const QString nativePath = QDir::toNativeSeparators( path );
71-
ITEMIDLIST *pidl = ILCreateFromPath( nativePath.toUtf8().constData() );
71+
72+
wchar_t *pathArray = new wchar_t[static_cast< uint>( nativePath.length() + 1 )];
73+
nativePath.toWCharArray(pathArray);
74+
pathArray[nativePath.length()] = 0;
75+
76+
ITEMIDLIST *pidl = ILCreateFromPathW( pathArray );
7277
if ( pidl )
7378
{
74-
SHOpenFolderAndSelectItems( pidl, 0, 0, 0 );
79+
SHOpenFolderAndSelectItems( pidl, 0, nullptr, 0 );
7580
ILFree( pidl );
7681
}
82+
83+
delete[] pathArray;
7784
}
7885

7986
void QgsWinNative::showUndefinedApplicationProgress()

0 commit comments

Comments
 (0)
Please sign in to comment.