Package PamController

Class PamFolders

java.lang.Object
PamController.PamFolders

public class PamFolders extends Object
Some static functions to handle PAMGuad default folder and to create them as and when necessary.
Author:
dg50
  • Constructor Details Link icon

    • PamFolders Link icon

      public PamFolders()
  • Method Details Link icon

    • checkFolder Link icon

      public static boolean checkFolder(String fullName, boolean create) throws PamFolderException
      Check and create a full folder name.
      Parameters:
      create - create if necessary
      folderName - full folder name
      Returns:
      true if folder exists and is OK.(can only return true, since exception thrown otherwise)
      Throws:
      PamFolderException
    • getProjectFolder Link icon

      public static String getProjectFolder(String subFolderName, boolean create) throws PamFolderException
      Get and create a sub-folder in the main project folder directory.
      Parameters:
      subFolderName - name of sub folder (without any separator characters).
      create - flag to say create the folder if it doesn't exist.
      Returns:
      full path name for the created folder.
      Throws:
      PamFolderException
    • getFileChooserPath Link icon

      public static File getFileChooserPath(String fileName)
      Get a file or folder to pass to a file chooser, which may be an existing file (e.g. if opening the database dialog and the database already exists), otherwise works backwards down the tree until at least something exists, otherwise starts in the folder containing the configuration file or database.
      Parameters:
      fileName - Initial hopes of what the file or folder is.
      Returns:
      closest possible path based on startPlan, or the folder with the psf.
    • getFileChooserPath Link icon

      public static File getFileChooserPath(File startPlan)
      Get a file or folder to pass to a file chooser, which may be an existing file (e.g. if opening the database dialog and the database already exists), otherwise works backwards down the tree until at least something exists, otherwise starts in the folder containing the configuration file or database.
      Parameters:
      startPlan - Initial hopes of what the file or folder is.
      Returns:
      closest possible path based on startPlan, or the folder with the psf.
    • getDefaultProjectFolder Link icon

      public static String getDefaultProjectFolder()
      Get a default folder for the project, that can be used when other folder names are null. It will try to set itself to the folder containing the psf or database file, failing that it will return the 'user.home'/pamguard folder.
      Returns:
      a default folder for the configuation.
    • getHomeFolder Link icon

      public static String getHomeFolder()
      Get and / or create the PAMGuard home folder. This is in user/Pamguard, e.g. C:\Users\**username**\Pamguard