Package gov.nih.mipav.view
Class GetPath
- java.lang.Object
-
- gov.nih.mipav.view.GetPath
-
public class GetPath extends java.lang.Object
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 < user directory >/mipav.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GetPath.Purpose
-
Constructor Summary
Constructors Constructor Description GetPath()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getPath(java.lang.String fileName, GetPath.Purpose purpose)
* Determine the best path for the indicated file.
-
-
-
Method Detail
-
getPath
public static java.lang.String getPath(java.lang.String fileName, GetPath.Purpose purpose)
* 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.
-
-