NTFileSystemAdapter: Bugfix: Do not make up a short name

This commit is contained in:
Tal Aloni 2018-11-23 23:33:43 +02:00
parent 4c29d5a402
commit f015b064d2
2 changed files with 1 additions and 27 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
/* Copyright (C) 2014-2018 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
*
* You can redistribute this program and/or modify it under the terms of
* the GNU Lesser Public License as published by the Free Software Foundation,
@ -183,7 +183,6 @@ namespace SMBLibrary
result.AllocationSize = (long)GetAllocationSize(entry.Size);
result.FileAttributes = GetFileAttributes(entry);
result.EaSize = 0;
result.ShortName = GetShortName(entry.Name);
result.FileName = entry.Name;
return result;
}
@ -225,7 +224,6 @@ namespace SMBLibrary
result.AllocationSize = (long)GetAllocationSize(entry.Size);
result.FileAttributes = GetFileAttributes(entry);
result.EaSize = 0;
result.ShortName = GetShortName(entry.Name);
result.FileId = 0;
result.FileName = entry.Name;
return result;

View file

@ -555,29 +555,5 @@ namespace SMBLibrary
{
return (ulong)Math.Ceiling((double)size / ClusterSize) * ClusterSize;
}
public static string GetShortName(string fileName)
{
string fileNameWithoutExt = System.IO.Path.GetFileNameWithoutExtension(fileName);
string extension = System.IO.Path.GetExtension(fileName);
if (fileNameWithoutExt.Length > 8 || extension.Length > 4)
{
if (fileNameWithoutExt.Length > 8)
{
fileNameWithoutExt = fileNameWithoutExt.Substring(0, 8);
}
if (extension.Length > 4)
{
extension = extension.Substring(0, 4);
}
return fileNameWithoutExt + extension;
}
else
{
return fileName;
}
}
}
}