Skip to content

Commit

Permalink
Better formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
FanDjango committed Feb 18, 2022
1 parent 722779f commit a2848b6
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions FluentFTP/Servers/Handlers/IbmZosFtpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,27 @@ public override async Task<long> GetFileSizeAsync(FtpClient client, string path,
/// </summary>
public override bool IsRoot(FtpClient client, string path) {

// If it is not a "/" root, it could perhaps be a z/OS root (like 'SYS1.')
// Note: If on z/OS you have somehow managed to CWD "over" the top, i.e.
// PWD returns "''" - you would need to CWD to some HLQ that only you can
// imagine. There is no way to list the available top level HLQs.
if (path == "/") return true;
if (path.StartsWith("/")) return false;
if (path.Trim('\'').TrimEnd('.').Split('.').Length <= 1) return true;
// PWD returns "''", it is also root - you would need to CWD to some HLQ
// that only you can imagine. There is no way to list the available top
// level HLQs.

// z/OS HFS root
if (path == "/") {
return true;
}

// z/OS HFS some path
if (path.StartsWith("/")) {
return false;
}

// z/OS HLQ (like 'SYS1.' or '')
if (path.Trim('\'').TrimEnd('.').Split('.').Length <= 1) {
return true;
}

// all others
return false;
}
}
Expand Down

0 comments on commit a2848b6

Please sign in to comment.