File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
#include < stdlib.h>
2
2
#include < stdio.h>
3
3
#include < unistd.h>
4
+ #include < iostream>
4
5
#include < QUrl>
5
6
#include < QDesktopServices>
7
+ #include < QString>
6
8
7
9
#ifdef Q_OS_WIN
8
10
#include < windows.h>
@@ -16,7 +18,15 @@ int main( int argc, char **argv )
16
18
fprintf ( stderr, " URL argument missing\n " );
17
19
exit ( 1 );
18
20
}
19
- QDesktopServices::openUrl ( QUrl ( argv[1 ] ) );
21
+ QUrl url ( argv[1 ] );
22
+ #ifdef Q_OS_WIN
23
+ // openUrl on windows fails to open 'file://c:...' it must be 'file:///c:...' (3 slashes)
24
+ if ( url.scheme () == " file" ) {
25
+ url.setPath ( " /" + url.path () );
26
+ std::cout << " path reset to: " << qPrintable (url.path ()) << std::endl;
27
+ }
28
+ #endif
29
+ QDesktopServices::openUrl ( url );
20
30
#ifdef Q_OS_WIN
21
31
Sleep ( 1000 );
22
32
#else
You can’t perform that action at this time.
0 commit comments