Package com.zaranux.os.client.commands

Source Code of com.zaranux.os.client.commands.rmdir

/**
*
*/
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 );
    }
   
  }

}
TOP

Related Classes of com.zaranux.os.client.commands.rmdir

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.