Package PamController
Class PamFolders
java.lang.Object
PamController.PamFolders
Some static functions to handle PAMGuad default folder and
to create them as and when necessary.
- Author:
- dg50
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkFolder
(String fullName, boolean create) Check and create a full folder name.static String
Get a default folder for the project, that can be used when other folder names are null.static File
getFileChooserPath
(File startPlan) Get a file or folder to pass to a file chooser, which may be an existing file (e.g.static File
getFileChooserPath
(String fileName) Get a file or folder to pass to a file chooser, which may be an existing file (e.g.static String
Get and / or create the PAMGuard home folder.static String
getProjectFolder
(String subFolderName, boolean create) Get and create a sub-folder in the main project folder directory.
-
Constructor Details
-
PamFolders
public PamFolders()
-
-
Method Details
-
checkFolder
Check and create a full folder name.- Parameters:
create
- create if necessaryfolderName
- full folder name- Returns:
- true if folder exists and is OK.(can only return true, since exception thrown otherwise)
- Throws:
PamFolderException
-
getProjectFolder
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
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
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
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
Get and / or create the PAMGuard home folder. This is in user/Pamguard, e.g. C:\Users\**username**\Pamguard
-