Skip to content

Commit

Permalink
Add IBM i as supported platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrez authored and soc committed Apr 13, 2021
1 parent d0bcea1 commit 51645df
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/dev/dirs/BaseDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private BaseDirectories() {
case LIN:
case BSD:
case SOLARIS:
case IBMI:
homeDir = System.getProperty("user.home");
cacheDir = defaultIfNullOrEmpty(System.getenv("XDG_CACHE_HOME"), homeDir, "/.cache");
configDir = defaultIfNullOrEmpty(System.getenv("XDG_CONFIG_HOME"), homeDir, "/.config");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/dev/dirs/ProjectDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public static ProjectDirectories fromPath(String path) {
case LIN:
case BSD:
case SOLARIS:
case IBMI:
homeDir = System.getProperty("user.home");
cacheDir = defaultIfNullOrEmptyExtended(System.getenv("XDG_CACHE_HOME"), path, homeDir + "/.cache/", path);
configDir = defaultIfNullOrEmptyExtended(System.getenv("XDG_CONFIG_HOME"), path, homeDir + "/.config/", path);
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/dev/dirs/UserDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ private UserDirectories() {
templateDir = null;
videoDir = homeDir + "/Movies";
break;
case IBMI:
homeDir = System.getProperty("user.home");
audioDir = homeDir + "/Music";
desktopDir = homeDir + "/Desktop";
documentDir = homeDir + "/Documents";
downloadDir = homeDir + "/Downloads";
fontDir = defaultIfNullOrEmptyExtended(System.getenv("XDG_DATA_HOME"), "/fonts", homeDir, "/.local/share/fonts");
pictureDir = homeDir + "/Pictures";
publicDir = homeDir + "/Public";
templateDir = null;
videoDir = homeDir + "/Movies";
break;
case WIN:
String[] winDirs = getWinDirs(
"5E6C858F-0E22-4760-9AFE-EA3317B67173",
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/dev/dirs/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private Util() {
static final char WIN = 'w';
static final char BSD = 'b';
static final char SOLARIS = 's';
static final char IBMI = 'i';

static final String UTF8_BOM = "\ufeff";

Expand All @@ -37,6 +38,8 @@ else if (os.contains("bsd"))
operatingSystem = BSD;
else if (os.contains("sunos"))
operatingSystem = SOLARIS;
else if (os.contains("os/400") || os.contains("os400"))
operatingSystem = IBMI;
else
throw new UnsupportedOperatingSystemException("directories are not supported on " + operatingSystemName);
}
Expand Down

0 comments on commit 51645df

Please sign in to comment.