Skip to content

Commit

Permalink
Fix problem of absolute directory name in cwd command
Browse files Browse the repository at this point in the history
  • Loading branch information
hxcan committed May 18, 2022
1 parent ea9f9a3 commit 78619ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ public void notifyLsCompleted()
*/
private void processCwdCommand(String targetWorkingDirectory)
{
String wholeDirecotoryPath= rootDirectory.getPath() + targetWorkingDirectory; // 构造完整路径。

wholeDirecotoryPath=wholeDirecotoryPath.replace("//", "/"); // 双斜杠替换成单斜杠

Log.d(TAG, "processSizeCommand: wholeDirecotoryPath: " + wholeDirecotoryPath); // Debug.
// String wholeDirecotoryPath= rootDirectory.getPath() + targetWorkingDirectory; // 构造完整路径。
//
// wholeDirecotoryPath=wholeDirecotoryPath.replace("//", "/"); // 双斜杠替换成单斜杠
//
// Log.d(TAG, "processCwdCommand: wholeDirecotoryPath: " + wholeDirecotoryPath); // Debug.


FilePathInterpreter filePathInterpreter=new FilePathInterpreter(); // Create the file path interpreter.
Expand Down Expand Up @@ -230,7 +230,7 @@ private void processCwdCommand(String targetWorkingDirectory)
} //if (photoDirecotry.isDirectory()) // 是个目录
else //不是个目录
{
replyString="550 not a directory: " + wholeDirecotoryPath ; // 回复内容。
replyString="550 not a directory: " + targetWorkingDirectory; // 回复内容。
}

Log.d(TAG, "reply string: " + replyString); //Debug.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ public class FilePathInterpreter

public File getFile(File rootDirectory, String currentWorkingDirectory, String data51) //照片目录。
{
String wholeDirecotoryPath = rootDirectory.getPath() + currentWorkingDirectory + "/" + data51; // 构造完整路径。
String currentWorkingDirectoryUpdate=currentWorkingDirectory; // 更新后的当前工作目录。

if (data51.startsWith("/")) // 绝对路径。
{
currentWorkingDirectoryUpdate="/"; // 当前工作目录更新为根目录。
}

String wholeDirecotoryPath = rootDirectory.getPath() + currentWorkingDirectoryUpdate + "/" + data51; // 构造完整路径。

wholeDirecotoryPath=wholeDirecotoryPath.replace("//", "/"); // 双斜杠替换成单斜杠

Expand Down

0 comments on commit 78619ec

Please sign in to comment.