Skip to content

Commit

Permalink
Version 1.0.1
Browse files Browse the repository at this point in the history
Sonarcloud fixes
  • Loading branch information
sanyarnd committed May 22, 2019
1 parent e09d12c commit 6ea0267
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -48,9 +48,9 @@ deploy:
- provider: releases
api_key: $GITHUB_API_KEY
file:
- /home/travis/build/sanyarnd/standard-paths/target/standard-paths-$TRAVIS_TAG.jar
- /home/travis/build/sanyarnd/standard-paths/target/standard-paths-$TRAVIS_TAG-javadoc.jar
- /home/travis/build/sanyarnd/standard-paths/target/standard-paths-$TRAVIS_TAG-sources.jar
- /home/travis/build/sanyarnd/standardpaths/target/standard-paths-$TRAVIS_TAG.jar
- /home/travis/build/sanyarnd/standardpaths/target/standard-paths-$TRAVIS_TAG-javadoc.jar
- /home/travis/build/sanyarnd/standardpaths/target/standard-paths-$TRAVIS_TAG-sources.jar
skip_cleanup: true
on:
tags: true
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
# 1.0.1
- Sonarcloud fixes

# 1.0
- Initial commit

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.com/sanyarnd/standardpaths.svg?branch=master)](https://travis-ci.com/sanyarnd/standardpaths)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=io.github.sanyarnd%3Astandard-paths&metric=coverage)](https://sonarcloud.io/dashboard?id=io.github.sanyarnd%3Astandard-paths)

Standard Paths is a small library which provides cross platform access to the common directories such as `AppData`, `Desktop` or `/tmp`.
Standard Paths is a small library which provides cross platform access to the common directories such as `AppData`, `Desktop` or `tmp`.

# Features
* All major distributions: `Windows`, `Linux`, `MacOS` (not yet implemented)
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/_config.yml
Expand Up @@ -3,7 +3,7 @@ plugins:
- jekyll-sitemap

title: "Standard Paths"
description: "Provides cross platform access to the common directories such as AppData, Desktop or /tmp"
description: "Provides cross platform access to the common directories such as AppData, Desktop or tmp"

github:
owner_name: "Alexander Biryukov"
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -6,12 +6,12 @@

<groupId>io.github.sanyarnd</groupId>
<artifactId>standard-paths</artifactId>
<version>1.0</version>
<version>1.0.1</version>
<url>https://sanyarnd.github.io/standardpaths/</url>
<packaging>jar</packaging>

<name>Standard Paths</name>
<description>Provides cross platform access to the common directories such as AppData, Desktop or /tmp</description>
<description>Provides cross platform access to the common directories such as AppData, Desktop or tmp</description>
<inceptionYear>2019</inceptionYear>

<licenses>
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/io/github/sanyarnd/standardpaths/OS.java
Expand Up @@ -53,11 +53,10 @@ enum OS {
*/
@NonNull
public static OS current() {
return name.contains("linux") ? LINUX : (
name.contains("mac") ? MAC : (
name.contains("win") ? WINDOWS : UNKNOWN
)
);
OS win = name.contains("win") ? WINDOWS : UNKNOWN;
OS nonLinux = name.contains("mac") ? MAC : win;

return name.contains("linux") ? LINUX : nonLinux;
}

public static boolean isWindows() { return OS.current() == OS.WINDOWS; }
Expand Down
Expand Up @@ -62,8 +62,8 @@ private static Path knownFolder(final Guid.@NonNull GUID folderId) {
Pointer pStr = ppStr.getValue();
StringBuilder sb = new StringBuilder();
// we'll never reach 4096 anyway
final int maxLengthInBytes = 4096;
for (int i = 0; i < maxLengthInBytes; ++i) {
final long maxLengthInBytes = 4096;
for (long i = 0; i < maxLengthInBytes; ++i) {
// SHGetKnownFolderPath returns wchar_t string, and offset is calculated in bytes
// so we actually need i*2 for correct indexation
char c = pStr.getChar(i * 2);
Expand Down

0 comments on commit 6ea0267

Please sign in to comment.