package seedu.taskmanager.logic.parser;

import static seedu.taskmanager.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import java.io.File;

import seedu.taskmanager.logic.commands.ChangeSaveLocationCommand;
import seedu.taskmanager.logic.commands.Command;
import seedu.taskmanager.logic.commands.IncorrectCommand;

public class ChangeSaveLocationCommandParser {

    public static final String INVALID_SAVE_LOCATION = "Invalid input for save location";

    /**
     * Parses the given {@code String} of arguments in the context of the
     * ChangeSaveLocationCommand and returns an ChangeSaveLocationCommand object
     * for execution.
     */

    public Command parse(String args) {

        // assert args != null;

        String stringLocation  = args;
        File checkLocation = new File(args.trim());

        if (("".equals(args))) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, ChangeSaveLocationCommand.MESSAGE_USAGE));
        }
        if (!checkLocation.exists()) {
            return new IncorrectCommand(String.format(ChangeSaveLocationCommand.MESSAGE_USAGE, INVALID_SAVE_LOCATION));
        }

        if (!(args.substring(args.length() - 1).equals("/"))){
            args += "/";
        }

        stringLocation += "taskmanager.xml";
        File saveLocation = new File(stringLocation.trim());

        return new ChangeSaveLocationCommand(saveLocation);
    }

}

@@ -742,24 +742,28 @@
 tring string
+Save
 Location  = 
@@ -759,17 +759,16 @@
 ocation 
- 
 = args;%0A
@@ -843,20 +843,34 @@
 .equals(
-args
+stringSaveLocation
 ))) %7B%0A  
@@ -1215,27 +1215,55 @@
  (!(
-args.substring(args
+stringSaveLocation.substring(stringSaveLocation
 .len
@@ -1300,20 +1300,34 @@
         
-args
+stringSaveLocation
  += %22/%22;
@@ -1348,24 +1348,28 @@
       string
+Save
 Location += 
@@ -1430,16 +1430,20 @@
 e(string
+Save
 Location

Fix further codacy issues