@@ -100,25 +100,28 @@ private static void DownloadRelease(JObject release)
100100
101101 if ( name != null && name . EndsWith ( ".dll" ) && url != null )
102102 {
103- string modPath = Path . Combine ( MelonEnvironment . ModsDirectory , name ) ;
104- MelonLogger . Msg ( $ "Attempting to download to: { modPath } ") ;
103+ string destinationFolder = name . Contains ( "Updater" , StringComparison . OrdinalIgnoreCase )
104+ ? MelonEnvironment . PluginsDirectory
105+ : MelonEnvironment . ModsDirectory ;
106+
107+ string targetPath = Path . Combine ( destinationFolder , name ) ;
108+ MelonLogger . Msg ( $ "Attempting to download to: { targetPath } ") ;
105109
106110 try
107111 {
108- if ( File . Exists ( modPath ) )
112+ if ( File . Exists ( targetPath ) )
109113 {
110- MelonLogger . Msg ( $ "Deleting existing file: { modPath } ") ;
111- File . Delete ( modPath ) ;
114+ MelonLogger . Msg ( $ "Deleting existing file: { targetPath } ") ;
115+ File . Delete ( targetPath ) ;
112116 }
113117
114118 using ( var client = new WebClient ( ) )
115119 {
116120 client . Headers . Add ( "User-Agent" , "ModUpdater" ) ;
117121 client . Headers . Add ( "Accept" , "application/octet-stream" ) ;
118122
119- client . DownloadFile ( url , modPath ) ;
120- MelonLogger . Msg ( $ "Updated mod downloaded: { name } ") ;
121- MelonLogger . Msg ( "Update applied. Please restart the game to load the new version." ) ;
123+ client . DownloadFile ( url , targetPath ) ;
124+ MelonLogger . Msg ( $ "Updated file downloaded: { name } ") ;
122125 }
123126 }
124127 catch ( Exception ex )
@@ -127,6 +130,9 @@ private static void DownloadRelease(JObject release)
127130 }
128131 }
129132 }
133+
134+ MelonLogger . Msg ( "Update(s) applied. Please restart the game to load the new version(s)." ) ;
130135 }
136+
131137 }
132138}
0 commit comments