fix bug with symbolic links
This commit is contained in:
parent
6757602b00
commit
6567881ce5
1 changed files with 13 additions and 3 deletions
|
@ -59,9 +59,12 @@ namespace AFCExplorer
|
|||
{
|
||||
if (fn == "." || fn == "..") continue;
|
||||
afc.afc_get_file_info(afcHandle, path + fn, out ReadOnlyCollection<string> fileInfo).ThrowOnError();
|
||||
string readableSize = FormatBytes(ulong.Parse(fileInfo[1]));
|
||||
string readableType = fileInfo[7] == "S_IFDIR" ? "Directory" : "File";
|
||||
int unixSeconds = (int)(((long.Parse(fileInfo[9]) / 1000) / 1000) / 1000);
|
||||
Dictionary<string, string> fileInfoD = new Dictionary<string, string>();
|
||||
for (int i = 0; i < fileInfo.Count; i += 2) fileInfoD.Add(fileInfo[i], fileInfo[i+1]);
|
||||
//MessageBox.Show(string.Join("\n", fileInfo));
|
||||
string readableSize = FormatBytes(ulong.Parse(fileInfoD["st_size"]));
|
||||
string readableType = ReadableTypes[fileInfoD["st_ifmt"]];
|
||||
int unixSeconds = (int)(((long.Parse(fileInfoD["st_mtime"]) / 1000) / 1000) / 1000);
|
||||
string readableTime = DateTimeOffset.FromUnixTimeSeconds(unixSeconds).DateTime.ToString();
|
||||
afcDirectory.Add(new AFCFileType(fn, readableType, readableTime, readableSize));
|
||||
}
|
||||
|
@ -359,5 +362,12 @@ namespace AFCExplorer
|
|||
|
||||
return string.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> ReadableTypes = new Dictionary<string, string>
|
||||
{
|
||||
{ "S_IFDIR", "Directory" },
|
||||
{ "S_IFREG", "File" },
|
||||
{ "S_IFLNK", "Symbolic Link" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue