Class XDG

java.lang.Object
org.pepsoft.util.XDG

public final class XDG extends Object
Utility class for accessing the freedesktop.org "XDG Base Directory Specification" directories as well as the "well known" user directories as managed by the xdg-user-dirs tool.

The string-typed constants are set whether or not the directory exists; either to the configured value or a default, if applicable. The file-typed constants are only set if the directory actually exists.

See http://standards.freedesktop.org/basedir-spec/latest/ and http://www.freedesktop.org/wiki/Software/xdg-user-dirs/

Created by Pepijn Schmitz on 19-03-15.

  • Field Details

    • HOME

      public static final String HOME
      The current user's home directory. Set to the value of the user.home system property.
    • XDG_DATA_HOME

      public static final String XDG_DATA_HOME
      Defines the base directory relative to which user specific data files should be stored. Set to the contents of the XDG_DATA_HOME environment variable, or "HOME/.local/share" if that variable is not present.
    • XDG_CONFIG_HOME

      public static final String XDG_CONFIG_HOME
      Defines the base directory relative to which user specific configuration files should be stored. Set to the contents of the XDG_CONFIG_HOME environment variable, or "HOME/.config" if that variable is not present.
    • XDG_DATA_DIRS

      public static final String XDG_DATA_DIRS
      Defines the preference-ordered set of base directories to search for data files in addition to the XDG_DATA_HOME base directory. Set to the contents of the XDG_DATA_DIRS environment variable, or "/usr/local/share:/usr/share" if that variable is not present.
    • XDG_CONFIG_DIRS

      public static final String XDG_CONFIG_DIRS
      Defines the preference-ordered set of base directories to search for configuration files in addition to the XDG_CONFIG_HOME base directory. Set to the contents of the XDG_CONFIG_DIRS environment variable, or "/etc/xdg" if that variable is not present.
    • XDG_CACHE_HOME

      public static final String XDG_CACHE_HOME
      Defines the base directory relative to which user specific non-essential data files should be stored. Set to the contents of the XDG_CACHE_HOME environment variable, or "HOME/.cache" if that variable is not present.
    • XDG_RUNTIME_DIR

      public static final String XDG_RUNTIME_DIR
      Defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. Set to the contents of the XDG_RUNTIME_DIR environment variable, or null if that variable is not present.
    • XDG_DATA_HOME_FILE

      public static final File XDG_DATA_HOME_FILE
      XDG_DATA_HOME as a File object, but only if that directory actually exists. null otherwise.
    • XDG_CONFIG_HOME_FILE

      public static final File XDG_CONFIG_HOME_FILE
      XDG_CONFIG_HOME as a File object, but only if that directory actually exists. null otherwise.
    • XDG_CACHE_HOME_FILE

      public static final File XDG_CACHE_HOME_FILE
      XDG_CACHE_HOME as a File object, but only if that directory actually exists. null otherwise.
    • XDG_RUNTIME_DIR_FILE

      public static final File XDG_RUNTIME_DIR_FILE
      XDG_RUNTIME_DIR as a File object, but only if XDG_RUNTIME_DIR is not null and that directory actually exists. null otherwise.
    • XDG_DESKTOP_DIR

      public static final String XDG_DESKTOP_DIR
      The location of the "desktop" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_DOCUMENTS_DIR

      public static final String XDG_DOCUMENTS_DIR
      The location of the "documents" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_DOWNLOAD_DIR

      public static final String XDG_DOWNLOAD_DIR
      The location of the "download" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_MUSIC_DIR

      public static final String XDG_MUSIC_DIR
      The location of the "music" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_PICTURES_DIR

      public static final String XDG_PICTURES_DIR
      The location of the "pictures" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_PUBLICSHARE_DIR

      public static final String XDG_PUBLICSHARE_DIR
      The location of the "public share" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_TEMPLATES_DIR

      public static final String XDG_TEMPLATES_DIR
      The location of the "templates" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_VIDEOS_DIR

      public static final String XDG_VIDEOS_DIR
      The location of the "videos" well known user directory, as specified in the appropriate system or user config file, or null if it is not configured.
    • XDG_DESKTOP_DIR_FILE

      public static final File XDG_DESKTOP_DIR_FILE
      XDG_DESKTOP_DIR as a File object, but only if XDG_DESKTOP_DIR is not null and that directory actually exists. null otherwise.
    • XDG_DOCUMENTS_DIR_FILE

      public static final File XDG_DOCUMENTS_DIR_FILE
      XDG_DOCUMENTS_DIR as a File object, but only if XDG_DOCUMENTS_DIR is not null and that directory actually exists. null otherwise.
    • XDG_DOWNLOAD_DIR_FILE

      public static final File XDG_DOWNLOAD_DIR_FILE
      XDG_DOWNLOAD_DIR as a File object, but only if XDG_DOWNLOAD_DIR is not null and that directory actually exists. null otherwise.
    • XDG_MUSIC_DIR_FILE

      public static final File XDG_MUSIC_DIR_FILE
      XDG_MUSIC_DIR as a File object, but only if XDG_MUSIC_DIR is not null and that directory actually exists. null otherwise.
    • XDG_PICTURES_DIR_FILE

      public static final File XDG_PICTURES_DIR_FILE
      XDG_PICTURES_DIR as a File object, but only if XDG_PICTURES_DIR is not null and that directory actually exists. null otherwise.
    • XDG_PUBLICSHARE_DIR_FILE

      public static final File XDG_PUBLICSHARE_DIR_FILE
      XDG_PUBLICSHARE_DIR as a File object, but only if XDG_PUBLICSHARE_DIR is not null and that directory actually exists. null otherwise.
    • XDG_TEMPLATES_DIR_FILE

      public static final File XDG_TEMPLATES_DIR_FILE
      XDG_TEMPLATES_DIR as a File object, but only if XDG_TEMPLATES_DIR is not null and that directory actually exists. null otherwise.
    • XDG_VIDEOS_DIR_FILE

      public static final File XDG_VIDEOS_DIR_FILE
      XDG_VIDEOS_DIR as a File object, but only if XDG_VIDEOS_DIR is not null and that directory actually exists. null otherwise.
  • Method Details

    • main

      public static void main(String[] args)