1
0
mirror of synced 2024-11-28 01:10:51 +01:00

Adjustments to zdict transfer

This commit is contained in:
KillzXGaming 2023-05-28 16:11:41 -04:00
parent 86e63a65cd
commit 6470c6ef34

View File

@ -86,21 +86,26 @@ namespace Toolbox.Library
if (!Directory.Exists(userDir)) if (!Directory.Exists(userDir))
Directory.CreateDirectory(userDir); Directory.CreateDirectory(userDir);
//Create folder for TOTK contents if it does not exist
if (!Directory.Exists(Path.Combine(userDir, "TOTK")))
Directory.CreateDirectory(Path.Combine(userDir, "TOTK"));
string folder = Path.Combine(userDir, "TOTK", "ZstdDictionaries"); string folder = Path.Combine(userDir, "TOTK", "ZstdDictionaries");
//Check if old directory exists and move it
string folderOld = Path.Combine(Runtime.ExecutableDir, "Lib", "ZstdDictionaries"); void TransferZDic(string path)
if (Directory.Exists(folderOld))
{ {
//Create folder for TOTK contents if it does not exist //Check if old directory contains the file and move it
if (!Directory.Exists(Path.Combine(userDir, "TOTK"))) string fileOld = Path.Combine(Runtime.ExecutableDir, "Lib", "ZstdDictionaries", path);
Directory.CreateDirectory(Path.Combine(userDir, "TOTK")); string fileNew = Path.Combine(folder, path);
//Remove previous folder with any old files incase it gets updated with additional content if (!File.Exists(fileNew) && File.Exists(fileOld))
if (Directory.Exists(folder)) {
Directory.Delete(folder, true); File.Move(fileOld, fileNew);
//Move old to new directory }
Directory.Move(folderOld, folder);
} }
TransferZDic("bcett.byml.zsdic");
TransferZDic("pack.zsdic");
TransferZDic("zs.zsdic");
if (Directory.Exists(folder)) if (Directory.Exists(folder))
{ {