Пример #1
0
 /**
  * Set the default location for the Roster file, and all individual locomotive files.
  *
  * @param f Absolute pathname to use. A null or "" argument flags a return to the original default
  *     in the user's files directory. This parameter must be a potentially valid path on the
  *     system.
  */
 public void setRosterLocation(String f) {
   String oldRosterLocation = this.rosterLocation;
   String p = f;
   if (p != null) {
     if (p.isEmpty()) {
       p = null;
     } else {
       p = FileUtil.getAbsoluteFilename(p);
       if (p == null) {
         throw new IllegalArgumentException(
             Bundle.getMessage("IllegalRosterLocation", f)); // NOI18N
       }
       if (!p.endsWith(File.separator)) {
         p = p + File.separator;
       }
     }
   }
   if (p == null) {
     p = FileUtil.getUserFilesPath();
   }
   this.rosterLocation = p;
   log.debug("Setting roster location from {} to {}", oldRosterLocation, this.rosterLocation);
   if (this.rosterLocation.equals(FileUtil.getUserFilesPath())) {
     log.debug("Roster location reset to default");
   }
   if (!this.rosterLocation.equals(oldRosterLocation)) {
     this.firePropertyChange(
         RosterConfigManager.DIRECTORY, oldRosterLocation, this.rosterLocation);
   }
   this.reloadRosterFile();
 }