mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-13 20:05:31 +00:00
8370719: [Linux] Use /etc/os-release values for font configuration file names
Reviewed-by: kizune, psadhukhan
This commit is contained in:
parent
245eeb41bc
commit
984c87cf76
@ -317,42 +317,14 @@ public final class FcFontConfiguration extends FontConfiguration {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
File f;
|
||||
if ((f = new File("/etc/lsb-release")).canRead()) {
|
||||
/* Ubuntu and (perhaps others) use only lsb-release.
|
||||
* Syntax and encoding is compatible with java properties.
|
||||
* For Ubuntu the ID is "Ubuntu".
|
||||
*/
|
||||
Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream(f)) {
|
||||
props.load(fis);
|
||||
}
|
||||
osName = extractInfo(props.getProperty("DISTRIB_ID"));
|
||||
osVersion = extractInfo(props.getProperty("DISTRIB_RELEASE"));
|
||||
} else if ((f = new File("/etc/redhat-release")).canRead()) {
|
||||
osName = "RedHat";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/SuSE-release")).canRead()) {
|
||||
osName = "SuSE";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/turbolinux-release")).canRead()) {
|
||||
osName = "Turbo";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/fedora-release")).canRead()) {
|
||||
osName = "Fedora";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/os-release")).canRead()) {
|
||||
File f = new File("/etc/os-release");
|
||||
if (f.canRead()) {
|
||||
Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream(f)) {
|
||||
props.load(fis);
|
||||
}
|
||||
osName = extractInfo(props.getProperty("NAME"));
|
||||
osName = extractInfo(props.getProperty("ID"));
|
||||
osVersion = extractInfo(props.getProperty("VERSION_ID"));
|
||||
if (osName.equals("SLES")) {
|
||||
osName = "SuSE";
|
||||
} else {
|
||||
osName = extractInfo(props.getProperty("ID"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (FontUtilities.debugFonts()) {
|
||||
|
||||
@ -91,42 +91,14 @@ public final class MFontConfiguration extends FontConfiguration {
|
||||
|
||||
if (osName.equals("Linux")) {
|
||||
try {
|
||||
File f;
|
||||
if ((f = new File("/etc/fedora-release")).canRead()) {
|
||||
osName = "Fedora";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/redhat-release")).canRead()) {
|
||||
osName = "RedHat";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/turbolinux-release")).canRead()) {
|
||||
osName = "Turbo";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/SuSE-release")).canRead()) {
|
||||
osName = "SuSE";
|
||||
osVersion = getVersionString(f);
|
||||
} else if ((f = new File("/etc/lsb-release")).canRead()) {
|
||||
/* Ubuntu and (perhaps others) use only lsb-release.
|
||||
* Syntax and encoding is compatible with java properties.
|
||||
* For Ubuntu the ID is "Ubuntu".
|
||||
*/
|
||||
File f = new File("/etc/os-release");
|
||||
if (f.canRead()) {
|
||||
Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream(f)) {
|
||||
props.load(fis);
|
||||
}
|
||||
osName = extractInfo(props.getProperty("DISTRIB_ID"));
|
||||
osVersion = extractInfo(props.getProperty("DISTRIB_RELEASE"));
|
||||
} else if ((f = new File("/etc/os-release")).canRead()) {
|
||||
Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream(f)) {
|
||||
props.load(fis);
|
||||
}
|
||||
osName = extractInfo(props.getProperty("NAME"));
|
||||
osName = extractInfo(props.getProperty("ID"));
|
||||
osVersion = extractInfo(props.getProperty("VERSION_ID"));
|
||||
if (osName.equals("SLES")) {
|
||||
osName = "SuSE";
|
||||
} else {
|
||||
osName = extractInfo(props.getProperty("ID"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user