January 2018
Beginner to intermediate
454 pages
10h 8m
English
This command is very simple as well. PWD stands for print working directory. Once again, it's not the one from your system but the one from your server (so again, "/" corresponds to the folder where you started the server).
The command doesn't take any argument, so there's no need to show you everything again. Let's just focus on the command handling:
Command::Pwd => {
let msg = format!("{}", self.cwd.to_str().unwrap_or(""));
if !msg.is_empty() {
let message = format!("\"/{}\" ", msg);
send_cmd(&mut self.stream, ResultCode::PATHNAMECreated, &format!("\"/{}\" ", msg))
} else {
send_cmd(&mut self.stream, ResultCode::FileNotFound, "No such file or directory")
}
}
Nothing complicated; we try to display the path, ...
Read now
Unlock full access