// Path: src/com/zlab/datFM/swiftp/Globals.java
// public class Globals {
//     private static String lastError;
//     private static File chrootDir = null;
//     private static String username = null;
// 
//     public static File getChrootDir() {
//         return chrootDir;
//     }
// 
//     public static void setChrootDir(File chrootDir) {
//         if (chrootDir.isDirectory()) {
//             Globals.chrootDir = chrootDir;
//         }
//     }
// 
//     public static String getLastError() {
//         return lastError;
//     }
// 
//     public static void setLastError(String lastError) {
//         Globals.lastError = lastError;
//     }
// 
//     public static String getUsername() {
//         return username;
//     }
// 
//     public static void setUsername(String username) {
//         Globals.username = username;
//     }
// 
// }


import com.zlab.datFM.swiftp.Globals;
import java.io.IOException;
import android.util.Log;
/*
Copyright 2009 David Revell

This file is part of SwiFTP.

SwiFTP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SwiFTP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SwiFTP.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.zlab.datFM.swiftp.server;



public class CmdPWD extends FtpCmd implements Runnable {
    private static final String TAG = CmdPWD.class.getSimpleName();

    public CmdPWD(SessionThread sessionThread, String input) {
        super(sessionThread);
    }

    @Override
    public void run() {
        Log.d(TAG, "PWD executing");
        // We assume that the chroot restriction has been applied, and that
        // therefore the current directory is located somewhere within the
        // chroot directory. Therefore, we can just slice of the chroot
        // part of the current directory path in order to get the
        // user-visible path (inside the chroot directory).
        try {
            String currentDir = sessionThread.getWorkingDir().getCanonicalPath();
// Path: src/com/zlab/datFM/swiftp/Globals.java
// public class Globals {
//     private static String lastError;
//     private static File chrootDir = null;
//     private static String username = null;
// 
//     public static File getChrootDir() {
//         return chrootDir;
//     }
// 
//     public static void setChrootDir(File chrootDir) {
//         if (chrootDir.isDirectory()) {
//             Globals.chrootDir = chrootDir;
//         }
//     }
// 
//     public static String getLastError() {
//         return lastError;
//     }
// 
//     public static void setLastError(String lastError) {
//         Globals.lastError = lastError;
//     }
// 
//     public static String getUsername() {
//         return username;
//     }
// 
//     public static void setUsername(String username) {
//         Globals.username = username;
//     }
// 
// }


// Path: src/com/zlab/datFM/swiftp/server/CmdPWD.java
import com.zlab.datFM.swiftp.Globals;
import java.io.IOException;
import android.util.Log;

/*
Copyright 2009 David Revell

This file is part of SwiFTP.

SwiFTP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SwiFTP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SwiFTP.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.zlab.datFM.swiftp.server;



public class CmdPWD extends FtpCmd implements Runnable {
    private static final String TAG = CmdPWD.class.getSimpleName();

    public CmdPWD(SessionThread sessionThread, String input) {
        super(sessionThread);
    }

    @Override
    public void run() {
        Log.d(TAG, "PWD executing");
        // We assume that the chroot restriction has been applied, and that
        // therefore the current directory is located somewhere within the
        // chroot directory. Therefore, we can just slice of the chroot
        // part of the current directory path in order to get the
        // user-visible path (inside the chroot directory).
        try {
            String currentDir = sessionThread.getWorkingDir().getCanonicalPath();
            currentDir = currentDir.substring(Globals.getChrootDir().getCanonicalPath()