Skip to content

Commit

Permalink
implement robinrodricks#41
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh Gupta committed Feb 1, 2017
1 parent 7fc0238 commit 81ac62b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions FluentFTP/FtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2812,6 +2812,7 @@ public FtpListItem[] GetListing(string path, FtpListOption options) {
string listcmd = null;
string pwd = GetWorkingDirectory();
string buf = null;
bool includeSelf = (options & FtpListOption.IncludeSelfAndParent) == FtpListOption.IncludeSelfAndParent;

if (path == null || path.Trim().Length == 0) {
pwd = GetWorkingDirectory();
Expand Down Expand Up @@ -2909,10 +2910,11 @@ public FtpListItem[] GetListing(string path, FtpListOption options) {
item = FtpListItem.Parse(path, buf, m_caps);
// FtpListItem.Parse() returns null if the line
// could not be parsed
if (item != null && (item.Name != "." && item.Name != ".."))
if (item != null && (includeSelf || !(item.Name == "." || item.Name == ".."))) {
lst.Add(item);
else
}else{
FtpTrace.WriteLine("Failed to parse file listing: " + buf);
}
}

// load extended information that wasn't available if the list options flags say to do so.
Expand Down
8 changes: 7 additions & 1 deletion FluentFTP/FtpEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ public enum FtpListOption {
/// Do not retrieve path when no path is supplied to GetListing(),
/// instead just execute LIST with no path argument.
/// </summary>
NoPath = 256
NoPath = 256,
/// <summary>
/// Include two extra items into the listing, for the current directory (".")
/// and the parent directory (".."). Meaningless unless you want these two
/// items for some reason.
/// </summary>
IncludeSelfAndParent = 512
}
}

0 comments on commit 81ac62b

Please sign in to comment.