remove old files before replacing them
This commit is contained in:
		| @@ -224,6 +224,11 @@ function downloadUpdateFiles(osuPath, updateFiles) { | |||||||
|         }); |         }); | ||||||
|       }); |       }); | ||||||
|       try { |       try { | ||||||
|  |         if (fs.existsSync(path.join(osuPath, fileName))) { | ||||||
|  |           await fs.promises.rm(path.join(osuPath, fileName), { | ||||||
|  |             force: true, | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|         await fs.promises.writeFile( |         await fs.promises.writeFile( | ||||||
|           path.join(osuPath, fileName), |           path.join(osuPath, fileName), | ||||||
|           axiosDownloadWithProgress.data, |           axiosDownloadWithProgress.data, | ||||||
| @@ -298,6 +303,11 @@ function downloadPatcherUpdates(osuPath, patcherUpdates) { | |||||||
|       }); |       }); | ||||||
|  |  | ||||||
|       try { |       try { | ||||||
|  |         if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) { | ||||||
|  |           await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), { | ||||||
|  |             force: true, | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|         await fs.promises.writeFile( |         await fs.promises.writeFile( | ||||||
|           path.join(osuPath, "EZPPLauncher", fileName), |           path.join(osuPath, "EZPPLauncher", fileName), | ||||||
|           axiosDownloadWithProgress.data, |           axiosDownloadWithProgress.data, | ||||||
| @@ -362,6 +372,12 @@ function downloadUIFiles(osuPath, uiFiles) { | |||||||
|         }, |         }, | ||||||
|       }); |       }); | ||||||
|       try { |       try { | ||||||
|  |         if (fs.existsSync(path.join(osuPath, "EZPPLauncher", fileName))) { | ||||||
|  |           await fs.promises.rm(path.join(osuPath, "EZPPLauncher", fileName), { | ||||||
|  |             force: true, | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         await fs.promises.writeFile( |         await fs.promises.writeFile( | ||||||
|           path.join(osuPath, "EZPPLauncher", fileName), |           path.join(osuPath, "EZPPLauncher", fileName), | ||||||
|           axiosDownloadWithProgress.data, |           axiosDownloadWithProgress.data, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user