On my client-side, if I cd into a directory and pwd it, it'll show me the correct pwd. (ftp> means client-side)
ftp> cd adam
ftp> pwd
remote working directory: amlodoz1/p1/adam
But if I then 'cd ..' out of it, and hit pwd, it gives me this:
ftp> cd ..
ftp> pwd
remote working directory: amlodoz1/p1/adam/..
Obviously, pwd should return amlodoz1/p1/
but it just likes to append whatever characters I cd into to the pathname.
My implementation for 'cd' and 'pwd' are here.
public void cd(String dirName) throws IOException{
System.out.println("Changing directory to '" + dirName + "'");
File dir = new File(dirName);
System.setProperty("user.dir", dir.getAbsolutePath());
}
public void pwd() throws IOException{
String pwd = System.getProperty("user.dir");
System.out.println("Remote working directory: " + pwd);
}
I was thinking about writing an if clause for 'cd ..' but I don't know what I would set the "user.dir" to in the setProperty function.