diff options
author | Jo Shields <joshield@microsoft.com> | 2017-02-21 17:47:35 +0300 |
---|---|---|
committer | Jo Shields <joshield@microsoft.com> | 2017-02-21 17:47:35 +0300 |
commit | 22772aed65a51ad97692c63c8fe0e8b7ea718b1d (patch) | |
tree | 0fa7da2352bf55ccc4187501876172d188200d0d /Mono.Addins/Mono.Addins.Database | |
parent | eea24ae654e8e31584b2b086b56e368456ddd86a (diff) |
Add some explanation behind 9b673202536788b2a2b98e4882e1a30d196bc897
Diffstat (limited to 'Mono.Addins/Mono.Addins.Database')
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/FileDatabase.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Mono.Addins/Mono.Addins.Database/FileDatabase.cs b/Mono.Addins/Mono.Addins.Database/FileDatabase.cs index ce00ea6..3fc88a6 100644 --- a/Mono.Addins/Mono.Addins.Database/FileDatabase.cs +++ b/Mono.Addins/Mono.Addins.Database/FileDatabase.cs @@ -451,6 +451,12 @@ namespace Mono.Addins.Database string GetFileKey (string directory, string sharedFileName, string objectId) { + // We have two magic numbers here. 240 is a "room to spare" number based on 255, + // the Windows MAX_PATH length for the full path of a file on disk. Then 130 is + // a "room to spare" number based on 143-"ish", the maximum filename length for + // files stored on eCryptFS on Linux. 240 relates to the complete path + // (including the directory structure), and 130 is just the filename, so we pick + // whichever is the smaller of those two numbers when truncating. int avlen = System.Math.Min (System.Math.Max (240 - directory.Length, 10), 130); string name = sharedFileName + "_" + Util.GetStringHashCode (objectId).ToString ("x"); if (name.Length > avlen) |