mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-06-05 03:47:14 +02:00
NTFileSystemAdapter: Bugfix: Do not make up a short name
This commit is contained in:
parent
4c29d5a402
commit
f015b064d2
2 changed files with 1 additions and 27 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue