//@@author A0139961U
package seedu.tache.logic.parser;

import static seedu.tache.commons.core.Messages.MESSAGE_INVALID_DIRECTORY;

import java.io.File;

import seedu.tache.logic.commands.Command;
import seedu.tache.logic.commands.IncorrectCommand;
import seedu.tache.logic.commands.SaveCommand;

/**
 * Parses input arguments and creates a new SaveCommand object
 */
public class SaveCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the SaveCommand
     * and returns an SaveCommand object for execution.
     */
    public Command parse(String args) {
        File directory = new File(args.trim());
        if (!directory.exists()) {
            directory.mkdir();
        }
        if (directory.isDirectory()) {
            return new SaveCommand(args.trim());
        } else {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_DIRECTORY, SaveCommand.MESSAGE_USAGE));
        }
    }

}

@@ -589,24 +589,177 @@
 ing args) %7B%0A
+        if (!(Character.toString(args.trim().charAt(0)).equals(%22/%22)) &&%0A                !(Character.toString(args.trim().charAt(0)).equals(%22%5C%5C%22))) %7B%0A    
         File
@@ -798,24 +798,28 @@
 ));%0A        
+    
 if (!directo
@@ -845,16 +845,20 @@
         
+    
 director
@@ -872,26 +872,34 @@
 ();%0A        
+   
+ 
 %7D%0A
+    
         if (
@@ -929,32 +929,36 @@
 ) %7B%0A            
+    
 return new SaveC
@@ -970,32 +970,206 @@
 d(args.trim());%0A
+            %7D else %7B%0A                return new IncorrectCommand(%0A                        String.format(MESSAGE_INVALID_DIRECTORY, SaveCommand.MESSAGE_USAGE));%0A            %7D%0A
         %7D else %7B

Fix bug when user enter "/" or "\" as directory