src/main/java/seedu/address/MainApp.java
/**
     * Returns a {@code UserPrefs} using the file at {@code storage}'s user prefs file path,
     * or a new {@code UserPrefs} with default configuration if errors occur when
     * reading from the file.
     */
Returns a  UserPrefs using the file at  storage's user prefs file path,
or a new  UserPrefs with default configuration if errors occur when
reading from the file.
Returns a UserPrefs using the file at storage ' s user prefs file path or a new UserPrefs with default configuration if errors occur when reading from the file .
protected UserPrefs initPrefs(UserPrefsStorage storage) {
        Path prefsFilePath = storage.getUserPrefsFilePath();
        logger.info("Using prefs file : " + prefsFilePath);
        UserPrefs initializedPrefs;
        try {
            Optional<UserPrefs> prefsOptional = storage.readUserPrefs();
            if (prefsOptional.isEmpty()) {
                logger.info("Preferences file not found. Will be starting with a default preferences file.");
            }
            initializedPrefs = prefsOptional.orElse(new UserPrefs());
        } catch (DataConversionException e) {
            logger.warning("UserPrefs file at " + prefsFilePath + " is not in the correct format. "
                    + "Using default user prefs");
            initializedPrefs = new UserPrefs();
        } catch (IOException e) {
            logger.warning("Problem while reading from the file. Will reset user prefs to default");
            initializedPrefs = new UserPrefs();
        }
        try {
            storage.saveUserPrefs(initializedPrefs);
        } catch (IOException e) {
            logger.warning("Failed to save config file : " + StringUtil.getDetails(e));
        }
        return initializedPrefs;
    }
protected UserPrefs initPrefs ( UserPrefsStorage storage ) { Path prefsFilePath = storage . getUserPrefsFilePath ( ) ; logger . info ( "Using prefs file : " + prefsFilePath ) ; UserPrefs initializedPrefs ; try { Optional < UserPrefs > prefsOptional = storage . readUserPrefs ( ) ; if ( prefsOptional . isEmpty ( ) ) { logger . info ( "Preferences file not found. Will be starting with a default preferences file." ) ; } initializedPrefs = prefsOptional . orElse ( new UserPrefs ( ) ) ; } catch ( DataConversionException e ) { logger . warning ( "UserPrefs file at " + prefsFilePath + " is not in the correct format. " + "Using default user prefs" ) ; initializedPrefs = new UserPrefs ( ) ; } catch ( IOException e ) { logger . warning ( "Problem while reading from the file. Will reset user prefs to default" ) ; initializedPrefs = new UserPrefs ( ) ; } try { storage . saveUserPrefs ( initializedPrefs ) ; } catch ( IOException e ) { logger . warning ( "Failed to save config file : " + StringUtil . getDetails ( e ) ) ; } return initializedPrefs ; }
Returns a {@code UserPrefs} using the file at {@code storage}'s user prefs file path,
 or a new {@code UserPrefs} with default configuration if errors occur when
 reading from the file.
Returns a { @code UserPrefs } using the file at { @code storage } ' s user prefs file path or a new { @code UserPrefs } with default configuration if errors occur when reading from the file .
//Update prefs file in case it was missing to begin with or there are new/unused fields