diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-14 00:22:16 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-14 00:22:16 +0300 |
commit | 6dfed02838c04e499e287dcc32c15e655664283d (patch) | |
tree | 26774f200eeb1af3af38a45e4207c198560b04fe /FtpServer | |
parent | 1923b2d55a0266c945364764df4e1d97b402c4d9 (diff) |
Many changes, updated to madmonkey's hakchi, zImage support, USB host support
Diffstat (limited to 'FtpServer')
-rw-r--r-- | FtpServer/NesMiniFileSystemHandler.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/FtpServer/NesMiniFileSystemHandler.cs b/FtpServer/NesMiniFileSystemHandler.cs index 5fb8b0ab..c505cb38 100644 --- a/FtpServer/NesMiniFileSystemHandler.cs +++ b/FtpServer/NesMiniFileSystemHandler.cs @@ -192,19 +192,26 @@ namespace mooftpserv List<FileSystemEntry> result = new List<FileSystemEntry>();
try
{
- var lines = clovershell.ExecuteSimple("ls -lApe \"" + newPath + "\"", 1000, true)
+ var lines = clovershell.ExecuteSimple("ls -lAp \"" + newPath + "\"", 1000, true)
.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var line in lines)
{
if (line.StartsWith("total")) continue;
FileSystemEntry entry = new FileSystemEntry();
entry.Mode = line.Substring(0, 13).Trim();
- entry.Name = line.Substring(69).Trim();
+ entry.Name = line.Substring(57).Trim();
entry.IsDirectory = entry.Name.EndsWith("/");
if (entry.IsDirectory) entry.Name = entry.Name.Substring(0, entry.Name.Length - 1);
- entry.Size = long.Parse(line.Substring(29, 15).Trim());
- var dt = line.Substring(44, 25).Trim();
- entry.LastModifiedTimeUtc = DateTime.ParseExact(dt, "ddd MMM d HH:mm:ss yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AllowInnerWhite);
+ entry.Size = long.Parse(line.Substring(34, 9).Trim());
+ var dt = line.Substring(44, 12).Trim();
+ try
+ {
+ entry.LastModifiedTimeUtc = DateTime.ParseExact(dt, "MMM d HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.AllowInnerWhite);
+ }
+ catch (FormatException)
+ {
+ entry.LastModifiedTimeUtc = DateTime.ParseExact(dt, "MMM d yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AllowInnerWhite);
+ }
result.Add(entry);
}
}
@@ -217,6 +224,8 @@ namespace mooftpserv public ResultOrError<string> ListEntriesRaw(string path)
{
+ if (path == null)
+ path = "/";
if (path.StartsWith("-"))
path = ". " + path;
string newPath = ResolvePath(path);
|