/**
*
*/
package com.zaranux.os.client.commands;
import com.zaranux.client.api.AsyncCallback;
import com.zaranux.client.java.io.File;
import com.zaranux.client.java.io.PrintStream;
import com.zaranux.os.client.util.Log;
public class rmdir extends Command{
@Override
protected void execute(final AsyncCallback<Boolean> callback) {
String[] args = getArgs();
final String folderName = getAbsolutePath( args[0] );
if(args[0] != "" && !(getCurrentDirectory().equalsIgnoreCase( folderName )))
{
File f = new File(folderName + "/fold");
f.delete(new AsyncCallback<Boolean>() {
public void onFailure(Throwable caught) {
System.out.print( "Failed to delete " + folderName, callback );
}
public void onSuccess(Boolean result) {
if (result) // if result is true, file is deleted
{
System.out.print( folderName + " is deleted.", callback );
} else {
System.out.print( "Failed to delete " + folderName, callback );
}
}
});
}
else
{
System.out.print( "No permission to delete current folder", callback );
}
}
}