mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
fix: other words chopped because url chopping doesn't check condition.
This commit is contained in:
parent
6bbb4d9971
commit
3dd0c83794
11
src/main.cc
11
src/main.cc
|
@ -176,10 +176,13 @@ void processCommandLine( QCoreApplication * app, GDOptions * result)
|
|||
|
||||
#if defined( Q_OS_LINUX ) || defined( Q_OS_WIN )
|
||||
// handle url scheme like "goldendict://" or "dict://" on windows/linux
|
||||
result->word.remove( 0, result->word.indexOf( "://" ) + 3 );
|
||||
// In microsoft Words, the / will be automatically appended
|
||||
if ( result->word.endsWith( "/" ) ) {
|
||||
result->word.chop( 1 );
|
||||
auto schemePos = result->word.indexOf( "://" );
|
||||
if ( schemePos != -1 ) {
|
||||
result->word.remove( 0, schemePos + 3 );
|
||||
// In microsoft Words, the / will be automatically appended
|
||||
if ( result->word.endsWith( "/" ) ) {
|
||||
result->word.chop( 1 );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue