Package io.github.astrapi69.file.search
Class PathFinder
java.lang.Object
io.github.astrapi69.file.search.PathFinder
The class PathFinder is a helper class for getting source folders from maven projects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The Constant SOURCE_FOLDER_SRC_MAIN_JAVA keeps the relative path for the source folder 'src/main/java' in maven projects.static final String
The Constant SOURCE_FOLDER_SRC_MAIN_RESOURCES keeps the relative path for the source folder 'src/main/resources' in maven projects.static final String
The Constant SOURCE_FOLDER_SRC_MAIN_WEBAPP keeps the relative path for the source folder 'src/main/webapp' in maven projects.static final String
The Constant SOURCE_FOLDER_SRC_TEST_JAVA keeps the relative path for the source folder 'src/test/java' in maven projects.static final String
The Constant SOURCE_FOLDER_SRC_TEST_RESOURCES keeps the relative path for the source folder 'src/test/resources' in maven projects. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getAbsolutePath
(File file, boolean removeLastChar) Gets the absolute path.static File
Gets the current directorystatic File
Gets the project directory.static File
getProjectDirectory
(File currentDir) Gets the project directory.static File
getRelativePath
(File parent, String... folders) Gets the file or directory from the given parent File object and the relative path given over the list as String objects.static File
getRelativePathTo
(File parent, String separator, String folders, String filename) Gets the file or directory from the given parent File object and the relative path given over the list as String objects.static File
getRelativePathTo
(File parent, List<String> folders) Gets the file or directory from the given parent File object and the relative path given over the list as String objects.static File
Gets the src main java dir.static File
getSrcMainJavaDir
(File projectDirectory) Gets the src main java dir.static File
Gets the src main resources dir.static File
getSrcMainResourcesDir
(File projectDirectory) Gets the src main resources dir.static File
Gets the src test java dir.static File
getSrcTestJavaDir
(File projectDirectory) Gets the src test java dir.static File
Gets the src test resources dir.static File
getSrcTestResourcesDir
(File projectDirectory) Gets the src test resources dir.
-
Field Details
-
SOURCE_FOLDER_SRC_MAIN_JAVA
The Constant SOURCE_FOLDER_SRC_MAIN_JAVA keeps the relative path for the source folder 'src/main/java' in maven projects.- See Also:
-
SOURCE_FOLDER_SRC_MAIN_RESOURCES
The Constant SOURCE_FOLDER_SRC_MAIN_RESOURCES keeps the relative path for the source folder 'src/main/resources' in maven projects.- See Also:
-
SOURCE_FOLDER_SRC_MAIN_WEBAPP
The Constant SOURCE_FOLDER_SRC_MAIN_WEBAPP keeps the relative path for the source folder 'src/main/webapp' in maven projects.- See Also:
-
SOURCE_FOLDER_SRC_TEST_JAVA
The Constant SOURCE_FOLDER_SRC_TEST_JAVA keeps the relative path for the source folder 'src/test/java' in maven projects.- See Also:
-
SOURCE_FOLDER_SRC_TEST_RESOURCES
The Constant SOURCE_FOLDER_SRC_TEST_RESOURCES keeps the relative path for the source folder 'src/test/resources' in maven projects.- See Also:
-
-
Method Details
-
getAbsolutePath
Gets the absolute path.- Parameters:
file
- the fileremoveLastChar
- the remove last char- Returns:
- the absolute path
-
getCurrentDirectory
Gets the current directory- Returns:
- the current directory
-
getProjectDirectory
Gets the project directory.- Returns:
- the project directory
-
getProjectDirectory
Gets the project directory.- Parameters:
currentDir
- the current dir- Returns:
- the project directory
-
getRelativePath
Gets the file or directory from the given parent File object and the relative path given over the list as String objects.- Parameters:
parent
- The parent directory.folders
- The list with the directories and optional a filename.- Returns:
- the resulted file or directory from the given arguments.
-
getRelativePathTo
Gets the file or directory from the given parent File object and the relative path given over the list as String objects.- Parameters:
parent
- The parent directory.folders
- The list with the directories and optional a filename.- Returns:
- the resulted file or directory from the given arguments.
-
getRelativePathTo
public static File getRelativePathTo(File parent, String separator, String folders, String filename) Gets the file or directory from the given parent File object and the relative path given over the list as String objects.- Parameters:
parent
- The parent directory.separator
- The separator for separate the String folders.folders
- The relative path as a String object separated with the defined separator.filename
- The filename.- Returns:
- the resulted file or directory from the given arguments.
-
getSrcMainJavaDir
Gets the src main java dir.- Returns:
- the src main java dir
-
getSrcMainJavaDir
Gets the src main java dir.- Parameters:
projectDirectory
- the project directory- Returns:
- the src main java dir
-
getSrcMainResourcesDir
Gets the src main resources dir.- Returns:
- the src main resources dir
-
getSrcMainResourcesDir
Gets the src main resources dir.- Parameters:
projectDirectory
- the project directory- Returns:
- the src main resources dir
-
getSrcTestJavaDir
Gets the src test java dir.- Returns:
- the src test java dir
-
getSrcTestJavaDir
Gets the src test java dir.- Parameters:
projectDirectory
- the project directory- Returns:
- the src test java dir
-
getSrcTestResourcesDir
Gets the src test resources dir.- Returns:
- the src test resources dir
-
getSrcTestResourcesDir
Gets the src test resources dir.- Parameters:
projectDirectory
- the project directory- Returns:
- the src test resources dir
-