* Handles CWD command.
*/
@Override
public void invoke(@NotNull final ClientSession session, @NotNull final String param) {
final FSView fsView = session.getFsView();
final Path dir = fsView.getPath(param);
if (!Files.exists(dir, NOFOLLOW_LINKS)) {
session.replyWithSpace(550, "No such directory.");
return;
}
if (!Files.isDirectory(dir, NOFOLLOW_LINKS)) {
session.replyWithSpace(550, "Not a directory.");
return;
}
fsView.changeDir(param);
session.replyWithSpace(200, "Directory changed to {}", fsView.getWorkingDir());
}