@@ -279,7 +279,7 @@ private static bool TryLaunchAsRebaseTodoEditor(string[] args, out int exitCode)
279279 if ( args . Length <= 1 || ! args [ 0 ] . Equals ( "--rebase-todo-editor" , StringComparison . Ordinal ) )
280280 return false ;
281281
282- var file = args [ 1 ] ;
282+ var file = args [ 1 ] . Replace ( ' \\ ' , '/' ) . Trim ( ' \" ' ) . Trim ( ) ;
283283 var filename = Path . GetFileName ( file ) ;
284284 if ( ! filename . Equals ( "git-rebase-todo" , StringComparison . OrdinalIgnoreCase ) )
285285 return true ;
@@ -308,7 +308,7 @@ private static bool TryLaunchAsRebaseMessageEditor(string[] args, out int exitCo
308308
309309 exitCode = 0 ;
310310
311- var file = args [ 1 ] ;
311+ var file = args [ 1 ] . Replace ( ' \\ ' , '/' ) . Trim ( ' \" ' ) . Trim ( ) ;
312312 var filename = Path . GetFileName ( file ) ;
313313 if ( ! filename . Equals ( "COMMIT_EDITMSG" , StringComparison . OrdinalIgnoreCase ) )
314314 return true ;
@@ -337,7 +337,7 @@ private bool TryLaunchAsFileHistoryViewer(IClassicDesktopStyleApplicationLifetim
337337 if ( args is not { Length : > 1 } || ! args [ 0 ] . Equals ( "--history" , StringComparison . Ordinal ) )
338338 return false ;
339339
340- var fullPath = Path . GetFullPath ( args [ 1 ] ) ;
340+ var fullPath = Path . GetFullPath ( args [ 1 ] . Replace ( ' \\ ' , '/' ) . Trim ( ' \" ' ) . Trim ( ) ) ;
341341 var dir = Path . GetDirectoryName ( fullPath ) ;
342342
343343 var test = new Commands . QueryRepositoryRootPath ( dir ) . GetResult ( ) ;
@@ -382,7 +382,7 @@ private bool TryLaunchAsBlameViewer(IClassicDesktopStyleApplicationLifetime desk
382382 if ( args is not { Length : > 1 } || ! args [ 0 ] . Equals ( "--blame" , StringComparison . Ordinal ) )
383383 return false ;
384384
385- var file = Path . GetFullPath ( args [ 1 ] ) ;
385+ var file = Path . GetFullPath ( args [ 1 ] . Replace ( ' \\ ' , '/' ) . Trim ( ' \" ' ) . Trim ( ) ) ;
386386 var dir = Path . GetDirectoryName ( file ) ;
387387
388388 var test = new Commands . QueryRepositoryRootPath ( dir ) . GetResult ( ) ;
@@ -417,7 +417,7 @@ private bool TryLaunchAsCoreEditor(IClassicDesktopStyleApplicationLifetime deskt
417417 if ( args is not { Length : > 1 } || ! args [ 0 ] . Equals ( "--core-editor" , StringComparison . Ordinal ) )
418418 return false ;
419419
420- var file = args [ 1 ] ;
420+ var file = args [ 1 ] . Replace ( ' \\ ' , '/' ) . Trim ( ' \" ' ) . Trim ( ) ;
421421 if ( ! File . Exists ( file ) )
422422 {
423423 desktop . Shutdown ( - 1 ) ;
@@ -453,12 +453,10 @@ private void TryLaunchAsNormal(IClassicDesktopStyleApplicationLifetime desktop)
453453 _ipcChannel = new Models . IpcChannel ( ) ;
454454 if ( ! _ipcChannel . IsFirstInstance )
455455 {
456- var arg = desktop . Args is { Length : > 0 } ? desktop . Args [ 0 ] . Trim ( ) : string . Empty ;
456+ var arg = desktop . Args is { Length : > 0 } ? desktop . Args [ 0 ] : string . Empty ;
457457 if ( ! string . IsNullOrEmpty ( arg ) )
458458 {
459- if ( arg . StartsWith ( '"' ) && arg . EndsWith ( '"' ) )
460- arg = arg . Substring ( 1 , arg . Length - 2 ) . Trim ( ) ;
461-
459+ arg = arg . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) . Trim ( '\" ' ) . Trim ( ) ;
462460 if ( arg . Length > 0 && ! Path . IsPathFullyQualified ( arg ) )
463461 arg = Path . GetFullPath ( arg ) ;
464462 }
@@ -472,8 +470,12 @@ private void TryLaunchAsNormal(IClassicDesktopStyleApplicationLifetime desktop)
472470 Models . AvatarManager . Instance . Start ( ) ;
473471
474472 string startupRepo = null ;
475- if ( desktop . Args is { Length : 1 } && Directory . Exists ( desktop . Args [ 0 ] ) )
476- startupRepo = desktop . Args [ 0 ] ;
473+ if ( desktop . Args is { Length : 1 } )
474+ {
475+ var arg = desktop . Args [ 0 ] . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) . Trim ( '\" ' ) . Trim ( ) ;
476+ if ( Directory . Exists ( arg ) )
477+ startupRepo = arg ;
478+ }
477479
478480 var pref = ViewModels . Preferences . Instance ;
479481 pref . SetCanModify ( ) ;
0 commit comments