Skip to content

Commit a9b5b73

Browse files
committed
Legacy cache will be archived
1 parent 691402d commit a9b5b73

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

gamevault/Helper/ProfileManager.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,36 @@ internal class ProfileManager
1717
public static void EnsureRootDirectory()
1818
{
1919
if (!Directory.Exists(ProfileRootDirectory))
20+
{
2021
Directory.CreateDirectory(ProfileRootDirectory);
22+
}
23+
else
24+
{
25+
MoveLegacyCache();
26+
}
27+
}
28+
private static void MoveLegacyCache()
29+
{
30+
try
31+
{
32+
string cache = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "GameVault", "cache");
33+
string config = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "GameVault", "config");
34+
string themes = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "GameVault", "themes");
35+
string legacyDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "GameVault", "legacy", "1.16.1.0");
36+
if (Directory.Exists(cache))
37+
{
38+
Directory.Move(cache,legacyDir);
39+
}
40+
if (Directory.Exists(config))
41+
{
42+
Directory.Move(config, legacyDir);
43+
}
44+
if (Directory.Exists(themes))
45+
{
46+
Directory.Move(themes, legacyDir);
47+
}
48+
}
49+
catch { }
2150
}
2251
public static UserProfile CreateUserProfile(string serverUrl)
2352
{

0 commit comments

Comments
 (0)