Skip to content

Commit

Permalink
BREAKING CHANGES: Migrate from io.github.soc to dev.dirs, ...
Browse files Browse the repository at this point in the history
... change behavior of `configDir` on macOS, release version 20.
  • Loading branch information
soc committed Jun 10, 2020
1 parent 1df8219 commit 6abb960
Show file tree
Hide file tree
Showing 11 changed files with 508 additions and 139 deletions.
274 changes: 274 additions & 0 deletions README-io.github.soc.md

Large diffs are not rendered by default.

63 changes: 43 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Maven Central](https://img.shields.io/maven-central/v/io.github.soc/directories.svg)](https://search.maven.org/#search|gav|1|g%3A%22io.github.soc%22%20AND%20a%3A%22directories%22)
[![API documentation](http://javadoc.io/badge/io.github.soc/directories.svg)](http://javadoc.io/doc/io.github.soc/directories)
[![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/master.svg?label=Linux%20build)](https://travis-ci.org/dirs-dev/directories-jvm)
[![AppVeyor status](https://img.shields.io/appveyor/ci/soc/directories-jvm/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/soc/directories-jvm/branch/master)
Expand All @@ -25,7 +25,7 @@ The library provides the location of these directories by leveraging the mechani

This library is written in Java, and runs on the JVM (≥ 6).

A version of this library implemented in Rust is provided by [directories-rs](https://github.com/soc/directories-rs).
A version of this library implemented in Rust is provided by [directories-rs](https://github.com/dirs-dev/directories-rs).

## Usage

Expand All @@ -36,19 +36,19 @@ Add the library as a dependency to your project:
##### Maven
```xml
<dependency>
<groupId>io.github.soc</groupId>
<groupId>dev.dirs</groupId>
<artifactId>directories</artifactId>
<version>12</version>
<version>20</version>
</dependency>
```
##### Gradle
```groovy
compile 'io.github.soc:directories:12'
compile 'dev.dirs:directories:20'
```

##### SBT
```scala
"io.github.soc" % "directories" % "12"
"dev.dirs" % "directories" % "20"
```

The library itself is built against Java 6 to allow for the widest possible usage scenarios.
Expand All @@ -59,9 +59,9 @@ It can be used on any Java version >= 6.
Library run by user Alice:

```java
import io.github.soc.directories.ProjectDirectories;
import io.github.soc.directories.BaseDirectories;
import io.github.soc.directories.UserDirectories;
import dev.dirs.ProjectDirectories;
import dev.dirs.BaseDirectories;
import dev.dirs.UserDirectories;

ProjectDirectories myProjDirs = ProjectDirectories.from("com", "Foo Corp", "Bar App");
myProjDirs.configDir;
Expand Down Expand Up @@ -114,14 +114,15 @@ that have been defined according to the conventions of the operating system the

If you want to compute the location of cache, config or data folders for your own application or project, use `ProjectDirectories` instead.

| Field name | Value on Linux / BSD | Value on Windows | Value on macOS |
| Field name | Value on Linux / BSD / Solaris | Value on Windows | Value on macOS |
| --------------- | ---------------------------------------------------------------- | --------------------------------- | ----------------------------------- |
| `homeDir` | `$HOME` | `{FOLDERID_UserProfile}` | `$HOME` |
| `cacheDir` | `$XDG_CACHE_HOME` or `$HOME`/.cache | `{FOLDERID_LocalApplicationData}` | `$HOME`/Library/Caches |
| `configDir` | `$XDG_CONFIG_HOME` or `$HOME`/.config | `{FOLDERID_ApplicationData}` | `$HOME`/Library/Preferences |
| `configDir` | `$XDG_CONFIG_HOME` or `$HOME`/.config | `{FOLDERID_ApplicationData}` | `$HOME`/Library/Application Support |
| `dataDir` | `$XDG_DATA_HOME` or `$HOME`/.local/share | `{FOLDERID_ApplicationData}` | `$HOME`/Library/Application Support |
| `dataLocalDir` | `$XDG_DATA_HOME` or `$HOME`/.local/share | `{FOLDERID_LocalApplicationData}` | `$HOME`/Library/Application Support |
| `executableDir` | `$XDG_BIN_HOME` or `$XDG_DATA_HOME`/../bin or `$HOME`/.local/bin | `null` | `null` |
| `preferencesDir`| `$XDG_CONFIG_HOME` or `$HOME`/.config | `{FOLDERID_ApplicationData}` | `$HOME`/Library/Preferences |
| `runtimeDir` | `$XDG_RUNTIME_DIR` or `null` | `null` | `null` |

### `UserDirectories`
Expand All @@ -147,13 +148,14 @@ that have been defined according to the conventions of the operating system the
The intended use-case for `ProjectDirectories` is to compute the location of cache, config or data folders for your own application or project,
which are derived from the standard directories.

| Field name | Value on Linux / BSD | Value on Windows | Value on macOS |
| -------------- | -------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------- |
| `cacheDir` | `$XDG_CACHE_HOME`/`<project_path>` or `$HOME`/.cache/`<project_path>` | `{FOLDERID_LocalApplicationData}`/`<project_path>`/cache | `$HOME`/Library/Caches/`<project_path>` |
| `configDir` | `$XDG_CONFIG_HOME`/`<project_path>` or `$HOME`/.config/`<project_path>` | `{FOLDERID_ApplicationData}`/`<project_path>`/config | `$HOME`/Library/Preferences/`<project_path>` |
| `dataDir` | `$XDG_DATA_HOME`/`<project_path>` or `$HOME`/.local/share/`<project_path>` | `{FOLDERID_ApplicationData}`/`<project_path>`/data | `$HOME`/Library/Application Support/`<project_path>` |
| `dataLocalDir` | `$XDG_DATA_HOME`/`<project_path>` or `$HOME`/.local/share/`<project_path>` | `{FOLDERID_LocalApplicationData}`/`<project_path>`/data | `$HOME`/Library/Application Support/`<project_path>` |
| `runtimeDir` | `$XDG_RUNTIME_DIR`/`<project_path>` | `null` | `null` |
| Field name | Value on Linux / BSD | Value on Windows | Value on macOS |
| --------------- | -------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------- |
| `cacheDir` | `$XDG_CACHE_HOME`/`<project_path>` or `$HOME`/.cache/`<project_path>` | `{FOLDERID_LocalApplicationData}`/`<project_path>`/cache | `$HOME`/Library/Caches/`<project_path>` |
| `configDir` | `$XDG_CONFIG_HOME`/`<project_path>` or `$HOME`/.config/`<project_path>` | `{FOLDERID_ApplicationData}`/`<project_path>`/config | `$HOME`/Library/Application Support/`<project_path>` |
| `dataDir` | `$XDG_DATA_HOME`/`<project_path>` or `$HOME`/.local/share/`<project_path>` | `{FOLDERID_ApplicationData}`/`<project_path>`/data | `$HOME`/Library/Application Support/`<project_path>` |
| `dataLocalDir` | `$XDG_DATA_HOME`/`<project_path>` or `$HOME`/.local/share/`<project_path>` | `{FOLDERID_LocalApplicationData}`/`<project_path>`/data | `$HOME`/Library/Application Support/`<project_path>` |
| `preferencesDir`| `$XDG_CONFIG_HOME`/`<project_path>` or `$HOME`/.config/`<project_path>` | `{FOLDERID_ApplicationData}`/`<project_path>`/config | `$HOME`/Library/Preferences/`<project_path>` |
| `runtimeDir` | `$XDG_RUNTIME_DIR`/`<project_path>` | `null` | `null` |

The specific value of `<project_path>` is computed by the

Expand Down Expand Up @@ -185,7 +187,25 @@ The version number of this library consists of a whole number, which is incremen

## Changelog

### 12 – current stable version
### 20 – current stable `dev.dirs:directories` release

- **BREAKING CHANGE** The behavior of `configDir` on macOS has been adjusted:
- The existing `BaseDirectories#configDir` has been changed to return the `Application Support` directory,
as suggested by Apple documentation.
- The newly added `BaseDirectories#preferencesDir` returns the `Preferences` directory now,
which – according to Apple documentation – shall only be used to store .plist files.
- The behavior of `configDir` on non-macOS platforms has not been changed.
`preferencesDir` behaves identical to `configDir` on non-macOS platforms.
- The behavior of `ProjectDirectories` has been adjusted accordingly.
- If you have used `BaseDirectories#configDir` or `ProjectDirectories#configDir` to store files,
it may be necessary to write code that migrates the files to the new location.
(Alternative: change usages of `configDir` to `preferencesDir` to keep the old behavior.)

### 19-13 – Reserved for bug fixes on `soc.github.io:directories`

### 12 – current stable legacy `soc.github.io:directories` release

_Please refer to [README-io.github.soc.md](README-io.github.soc.md) for the documentation and artefact coordinates._

- Adjust library to deal with breaking changes in Java caused by CVE-2019-2958 (see JDK-8221858). Thanks @alexarchambault!
- Support Solaris. Thanks @tomasjura!
Expand Down Expand Up @@ -267,3 +287,6 @@ The version number of this library consists of a whole number, which is incremen
- Changes to the directory for executables:
- Support for `executableDir` has been dropped on macOS.
- The value of `executableDir` considers `$XDG_BIN_HOME` now, before falling back to `$XDG_DATA_HOME/../bin` and `$HOME/.local/bin`.

### 5-1 – Unpublished beta releases

12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
lazy val root = (project in file("."))
.settings(
name := "directories",
organization := "io.github.soc",
organization := "dev.dirs",
managedScalaInstance := false,
crossPaths := false,
version := "12",
homepage := Some(url("https://github.com/soc/directories-jvm")),
version := "20",
homepage := Some(url("https://github.com/dirs-dev/directories-jvm")),
licenses := Seq("Mozilla Public License 2.0" -> url("https://opensource.org/licenses/MPL-2.0")),
fork := true,
// The javaHome setting can be removed if building against the latest installed version of Java is acceptable.
Expand All @@ -25,14 +25,14 @@ lazy val root = (project in file("."))
packageOptions in (Compile, packageBin) += {
import java.util.jar.{Attributes, Manifest}
val manifest = new Manifest
manifest.getMainAttributes.put(new Attributes.Name("Automatic-Module-Name"), "io.github.soc.directories")
manifest.getMainAttributes.put(new Attributes.Name("Automatic-Module-Name"), "dev.dirs.directories")
Package.JarManifest(manifest)
},
pomIncludeRepository := { _ => false },
pomExtra :=
<scm>
<url>git@github.com:soc/directories-jvm.git</url>
<connection>scm:git:git@github.com:soc/directories-jvm.git</connection>
<url>git@github.com:dirs-dev/directories-jvm.git</url>
<connection>scm:git:git@github.com:dirs-dev/directories-jvm.git</connection>
</scm>
<developers>
<developer>
Expand Down
Loading

0 comments on commit 6abb960

Please sign in to comment.