All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.postgresql.util.OSUtil Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2021, PostgreSQL Global Development Group
 * See the LICENSE file in the project root for more information.
 */

package org.postgresql.util;

import java.io.File;
import java.util.Locale;

/**
 * Operating system specifics
 */
public class OSUtil {

  /**
   *
   * @return true if OS is windows
   */
  public static boolean isWindows() {
    return System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
  }

  /**
   *
   * @return OS specific root directory for user specific configurations
   */
  public static String getUserConfigRootDirectory() {
    if (isWindows()) {
      return System.getenv("APPDATA") + File.separator + "postgresql";
    } else {
      return System.getProperty("user.home");
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy