@@ -563,26 +563,7 @@ public void OpenFileInDefaultProgram(string fileName, string OpensWith = null)
563563 if ( string . IsNullOrEmpty ( executable ) && ! WindowsFileAssociation . NativelyHandledExtensions . Contains ( effectiveExtension ) )
564564 {
565565 //Attempt to get relative projects
566- FilePath ? absoluteExe = null ;
567- if ( GumFileExtensions . Contains ( textExtension . ToLower ( ) ) )
568- {
569- absoluteExe = GlueState . Self . GlueExeDirectory + "../../../../../../Gum/Gum/bin/Debug/Data/Gum.exe" ;
570-
571- if ( absoluteExe ? . Exists ( ) == false )
572- {
573- absoluteExe = GlueState . Self . GlueExeDirectory + "Gum/Data/Gum.exe" ;
574- }
575- }
576- if ( String . Equals ( textExtension , "achx" , StringComparison . OrdinalIgnoreCase ) )
577- {
578- absoluteExe = GlueState . Self . GlueExeDirectory + "../../../../AnimationEditor/PreviewProject/bin/Debug/AnimationEditor.exe" ;
579- var foundAnimationEditor = absoluteExe ? . Exists ( ) == true ;
580- if ( ! foundAnimationEditor )
581- {
582- // check if it's in the default built location if the user is running from prebuilt:
583- absoluteExe = GlueState . Self . GlueExeDirectory + "AnimationEditor/AnimationEditor.exe" ;
584- }
585- }
566+ FilePath absoluteExe = TryToGetFilePathFromExtension ( textExtension ) ;
586567 if ( ( absoluteExe != "" ) && absoluteExe ? . Exists ( ) == true )
587568 {
588569 Process . Start ( new ProcessStartInfo ( absoluteExe . FullPath , fileName ) ) ;
@@ -655,6 +636,32 @@ void OpenProcess()
655636 }
656637 }
657638
639+ private FilePath TryToGetFilePathFromExtension ( string textExtension )
640+ {
641+ FilePath ? absoluteExe = null ;
642+ if ( GumFileExtensions . Contains ( textExtension . ToLower ( ) ) )
643+ {
644+ absoluteExe = GlueState . Self . GlueExeDirectory + "../../../../../../Gum/Gum/bin/Debug/Data/Gum.exe" ;
645+
646+ if ( absoluteExe ? . Exists ( ) == false )
647+ {
648+ absoluteExe = GlueState . Self . GlueExeDirectory + "Gum/Data/Gum.exe" ;
649+ }
650+ }
651+ if ( String . Equals ( textExtension , "achx" , StringComparison . OrdinalIgnoreCase ) )
652+ {
653+ absoluteExe = GlueState . Self . GlueExeDirectory + "../../../../AnimationEditor/PreviewProject/bin/Debug/AnimationEditor.exe" ;
654+ var foundAnimationEditor = absoluteExe ? . Exists ( ) == true ;
655+ if ( ! foundAnimationEditor )
656+ {
657+ // check if it's in the default built location if the user is running from prebuilt:
658+ absoluteExe = GlueState . Self . GlueExeDirectory + "AnimationEditor/AnimationEditor.exe" ;
659+ }
660+ }
661+
662+ return absoluteExe ;
663+ }
664+
658665 private static string GetFileName ( ReferencedFileSave currentReferencedFileSave )
659666 {
660667 string fileName = null ;
0 commit comments