Enum WindowsSpecialFolder

java.lang.Object
java.lang.Enum<WindowsSpecialFolder>
org.terracotta.utilities.test.io.WindowsSpecialFolder
All Implemented Interfaces:
Serializable, Comparable<WindowsSpecialFolder>, java.lang.constant.Constable

public enum WindowsSpecialFolder extends Enum<WindowsSpecialFolder>
Provides the value for Windows Special Folder identifiers.

The values represented by this enumeration are determined when first referenced by calling PowerShell to obtain the path assigned to the special folder identifier.

See Also:
  • Enum Constant Details

    • COMMON_APPLICATION_DATA

      public static final WindowsSpecialFolder COMMON_APPLICATION_DATA
      Provides the Path corresponding to the CommonApplicationData special folder. A get via this constant will attempt to create the folder if it does not already exist.
    • SYSTEM

      public static final WindowsSpecialFolder SYSTEM
      Provides the Path corresponding to the System special folder.
  • Field Details

  • Constructor Details

    • WindowsSpecialFolder

      private WindowsSpecialFolder(String identifier, boolean create)
  • Method Details

    • values

      public static WindowsSpecialFolder[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static WindowsSpecialFolder valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public Path get() throws IOException
      Gets the Path assigned to the identified special folder.
      Returns:
      the special folder Path
      Throws:
      IOException - if an error is raised while attempting to determine the Path for the special folder
    • getSpecialFolder

      private static Path getSpecialFolder(String specialFolderId, boolean create) throws IOException
      Gets the Path to the identified Windows Special Folder.
      Parameters:
      specialFolderId - the special folder identifier
      create - if true, attempts to create the folder if it does not exist
      Returns:
      the path to the special folder; an empty path is returned if the folder does not exist
      Throws:
      IOException - if the special folder value cannot be determined