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