Package gov.nih.mipav.view
Class GetPath
java.lang.Object
gov.nih.mipav.view.GetPath
This is a static helper class for finding the path to a number of important files to the MIPAV application. For
example, the mipav.preference file is stored in the invalid input: '<' user directory >/mipav.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetPath(String fileName, GetPath.Purpose purpose) * Determine the best path for the indicated file.
-
Constructor Details
-
GetPath
public GetPath()
-
-
Method Details
-
getPath
* Determine the best path for the indicated file. The* best path depends on the purpose: reading or writing* the file. When reading a file, first check the user's* home for a user specific version of the file. If no file* is found there, then try the working directory (user.dir),* if the file still can't be found, then look in the class path,* and lastly look in the directory containing the main class.** When writing a file, the file should be saved in the user's* home directory (user.home). The user should always have write* permissions here and this allows for different preferences for* different users.**- Parameters:
fileName- - the name of the file whose path needs to be found.*purpose- - the purpose for getting this path -- use the GetPath.FOR_READING or GetPath.FOR_WRITING*- Returns:
- the path to the file for reading or writing. Returns _null_ if the file cannot be found.
-