Skip to content

Commit

Permalink
fdbPathLevels
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Feb 4, 2023
1 parent a99715b commit f642cd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions AppInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static AppInit conf

public bool evercache = false;

public int fdbPathLevels = 2;

public int timeStatsUpdate = 20; // минут

public int timeSync = 10; // минут
Expand Down
13 changes: 11 additions & 2 deletions Engine/FileDB/staticDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ static FileDB()
static string pathDb(string key)
{
string md5key = HashTo.md5(key);
Directory.CreateDirectory($"Data/fdb/{md5key[0]}");
return $"Data/fdb/{md5key[0]}/{md5key}";

if (AppInit.conf.fdbPathLevels == 2)
{
Directory.CreateDirectory($"Data/fdb/{md5key.Substring(0, 2)}");
return $"Data/fdb/{md5key.Substring(0, 2)}/{md5key.Substring(2)}";
}
else
{
Directory.CreateDirectory($"Data/fdb/{md5key[0]}");
return $"Data/fdb/{md5key[0]}/{md5key}";
}
}

static string keyDb(string name, string originalname)
Expand Down

0 comments on commit f642cd1

Please sign in to comment.