java.lang.Object
io.github.astrapi69.file.search.PathFinder

public final class PathFinder extends Object
The class PathFinder is a helper class for getting source folders from maven projects.
  • Field Details

    • SOURCE_FOLDER_SRC_MAIN_JAVA

      public static final String 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

      public static final String 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

      public static final String 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

      public static final String 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

      public static final String 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

      public static String getAbsolutePath(File file, boolean removeLastChar)
      Gets the absolute path.
      Parameters:
      file - the file
      removeLastChar - the remove last char
      Returns:
      the absolute path
    • getCurrentDirectory

      public static File getCurrentDirectory()
      Gets the current directory
      Returns:
      the current directory
    • getProjectDirectory

      public static File getProjectDirectory()
      Gets the project directory.
      Returns:
      the project directory
    • getProjectDirectory

      public static File getProjectDirectory(File currentDir)
      Gets the project directory.
      Parameters:
      currentDir - the current dir
      Returns:
      the project directory
    • getRelativePath

      public 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.
      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, 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.
      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

      public static File getSrcMainJavaDir()
      Gets the src main java dir.
      Returns:
      the src main java dir
    • getSrcMainJavaDir

      public static File getSrcMainJavaDir(File projectDirectory)
      Gets the src main java dir.
      Parameters:
      projectDirectory - the project directory
      Returns:
      the src main java dir
    • getSrcMainResourcesDir

      public static File getSrcMainResourcesDir()
      Gets the src main resources dir.
      Returns:
      the src main resources dir
    • getSrcMainResourcesDir

      public static File getSrcMainResourcesDir(File projectDirectory)
      Gets the src main resources dir.
      Parameters:
      projectDirectory - the project directory
      Returns:
      the src main resources dir
    • getSrcTestJavaDir

      public static File getSrcTestJavaDir()
      Gets the src test java dir.
      Returns:
      the src test java dir
    • getSrcTestJavaDir

      public static File getSrcTestJavaDir(File projectDirectory)
      Gets the src test java dir.
      Parameters:
      projectDirectory - the project directory
      Returns:
      the src test java dir
    • getSrcTestResourcesDir

      public static File getSrcTestResourcesDir()
      Gets the src test resources dir.
      Returns:
      the src test resources dir
    • getSrcTestResourcesDir

      public static File getSrcTestResourcesDir(File projectDirectory)
      Gets the src test resources dir.
      Parameters:
      projectDirectory - the project directory
      Returns:
      the src test resources dir