Skip to content

Commit

Permalink
Merge pull request #3 from coursier/upstream-changes
Browse files Browse the repository at this point in the history
Merge upstream changes
  • Loading branch information
alexarchambault authored May 28, 2024
2 parents c4ddd07 + eb23aab commit a44c879
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[![Maven Central](https://img.shields.io/maven-central/v/dev.dirs/directories.svg)](https://search.maven.org/#search|gav|1|g%3A%22dev.dirs%22%20AND%20a%3A%22directories%22)
[![API documentation](http://javadoc.io/badge/dev.dirs/directories.svg)](http://javadoc.io/doc/dev.dirs/directories)
![actively developed](https://img.shields.io/badge/maintenance-actively_developed-brightgreen.svg)
[![TravisCI status](https://img.shields.io/travis/dirs-dev/directories-jvm/main.svg?label=Linux%20build)](https://travis-ci.org/dirs-dev/directories-jvm)
[![AppVeyor status](https://img.shields.io/appveyor/ci/soc/directories-jvm/main.svg?label=Windows%20build)](https://ci.appveyor.com/project/soc/directories-jvm/branch/main)
[![License: MPL-2.0](https://img.shields.io/github/license/dirs-dev/directories-jvm.svg)](LICENSE)
[![Maven Central](https://img.shields.io/maven-central/v/dev.dirs/directories.svg?style=for-the-badge)](https://search.maven.org/#search|gav|1|g%3A%22dev.dirs%22%20AND%20a%3A%22directories%22)
[![API documentation](http://javadoc.io/badge/dev.dirs/directories.svg?style=for-the-badge)](http://javadoc.io/doc/dev.dirs/directories)
![actively developed](https://img.shields.io/badge/maintenance-actively_developed-brightgreen.svg?style=for-the-badge)
[![GitHub Actions status](https://img.shields.io/github/actions/workflow/status/dirs-dev/directories-jvm/test.yml?branch=main&style=for-the-badge)](https://github.com/dirs-dev/directories-jvm/actions/workflows/test.yml)
[![License: MPL-2.0](https://img.shields.io/github/license/dirs-dev/directories-jvm.svg?style=for-the-badge)](LICENSE)

# Directories

Expand Down Expand Up @@ -38,17 +37,17 @@ Add the library as a dependency to your project:
<dependency>
<groupId>dev.dirs</groupId>
<artifactId>directories</artifactId>
<version>20</version>
<version>26</version>
</dependency>
```
##### Gradle
```groovy
compile 'dev.dirs:directories:20'
compile 'dev.dirs:directories:26'
```

##### SBT
```scala
"dev.dirs" % "directories" % "20"
"dev.dirs" % "directories" % "26"
```

The library itself is built against Java 6 to allow for the widest possible usage scenarios.
Expand Down Expand Up @@ -186,7 +185,15 @@ The version number of this library consists of a whole number, which is incremen

## Changelog

### 24 – current stable `dev.dirs:directories` release
### 26 – current stable `dev.dirs:directories` release

- Adds support for IBM Series i (OS/400). Thanks @ThePrez!

### 25
- Release with newer JavaDoc version.
- Update SBT version to 1.5.0.

### 24

- Try both "normal" and "downgraded" version of Powershell.
Hopefully fixes #47. Thanks @phongngtuan!
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/dev/dirs/BaseDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ private BaseDirectories() {
case LIN:
case BSD:
case SOLARIS:
case IBMI:
case AIX:
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
6 changes: 5 additions & 1 deletion src/main/java/dev/dirs/ProjectDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public static ProjectDirectories fromPath(String path, GetWinDirs getWinDirs) {
case LIN:
case BSD:
case SOLARIS:
case IBMI:
case AIX:
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 Expand Up @@ -302,6 +304,8 @@ public static ProjectDirectories from(String qualifier, String organization, Str
case LIN:
case BSD:
case SOLARIS:
case IBMI:
case AIX:
path = trimLowercaseReplaceWhitespace(application, "", true);
break;
case MAC:
Expand All @@ -311,7 +315,7 @@ public static ProjectDirectories from(String qualifier, String organization, Str
path = windowsApplicationPath(qualifier, organization, application);
break;
default:
throw new UnsupportedOperatingSystemException("Base directories are not supported on " + operatingSystemName);
throw new UnsupportedOperatingSystemException("Project directories are not supported on " + operatingSystemName);
}
return fromPath(path, getWinDirs);
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/dev/dirs/UserDirectories.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ private UserDirectories() {
case LIN:
case BSD:
case SOLARIS:
case AIX:
String[] userDirs = getXDGUserDirs("MUSIC", "DESKTOP", "DOCUMENTS", "DOWNLOAD", "PICTURES", "PUBLICSHARE", "TEMPLATES", "VIDEOS");
homeDir = System.getProperty("user.home");
audioDir = userDirs[0];
Expand All @@ -327,6 +328,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
6 changes: 6 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,8 @@ private Util() {
static final char WIN = 'w';
static final char BSD = 'b';
static final char SOLARIS = 's';
static final char IBMI = 'i';
static final char AIX = 'a';

static final String UTF8_BOM = "\ufeff";

Expand All @@ -37,6 +39,10 @@ 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 if (os.contains("aix"))
operatingSystem = AIX;
else
throw new UnsupportedOperatingSystemException("directories are not supported on " + operatingSystemName);
}
Expand Down

0 comments on commit a44c879

Please sign in to comment.