I am confused by the way this library works. The confusion has led to alot of convoluted code and I need help straightening it out.
I have a server (filezilla's FTP server for windows) that hosting 2 ftp users (user1 and user 2). The root of user1's "home" or root folder is actually c:\ftp\users\user1 and the root of user2's ftp folder is actually c:\ftp\users\user2. In each case, when they log in via a normal ftp client, there is no available parent directory as their users have a virtual root of whatever the home folder is (meaning they can cd ..)
My problem is that I am having trouble listing these directories and getting consistent results.
For instance, I execute ftoClient.dirDetails("/") for user1, I get an array of FTPFile objects (actually an array of 1) with the following details:
[ {
group: "ftp",
isDir: false,
name: "text.txt",
path: "///",
size: 151,
lastModified: 1297377540000,
... other attributes omitted
}
]
Now later, I loop through this array and I do a dirDetails() against the contents of the name attribute (text.txt) and I get the following:
[ {
group: "ftp",
isDir: false,
name: "text.txt",
path: "//text.txt",
size: 151,
lastModified: 1297377540000,
... other attributes omitted
}
]
So now I have several questions:
1) why is the path inconsistent ("///" vs "//text.txt") when listing directory details of a directory vs listing directory details on a file? It is the same object each time. Shouldn't it have the same path regardless of which object is the root?
2) why does the path start with 2 extra "/" characters in both cases? The root is actually "/", There is no possible way a filename can start with 2 "/".
3) shouldn't calling dirDetails on a file (as apposed to a directory) result in some kind of exception?
4) is there a more consistent way to get FTPFile objects based on paths?