From 6ea0267f66da02f9fccaff7fa0cab27740b88518 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Wed, 22 May 2019 17:23:04 +0300 Subject: [PATCH] Version 1.0.1 Sonarcloud fixes --- .travis.yml | 6 +++--- CHANGELOG.md | 3 +++ README.md | 2 +- gh-pages/_config.yml | 2 +- pom.xml | 4 ++-- src/main/java/io/github/sanyarnd/standardpaths/OS.java | 9 ++++----- .../github/sanyarnd/standardpaths/WindowsLocations.java | 4 ++-- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5ef428a..eb4ce1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f66fb..2fccde5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.1 +- Sonarcloud fixes + # 1.0 - Initial commit diff --git a/README.md b/README.md index e4d2068..33bc6d0 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/gh-pages/_config.yml b/gh-pages/_config.yml index b66cac3..0d677ba 100644 --- a/gh-pages/_config.yml +++ b/gh-pages/_config.yml @@ -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" diff --git a/pom.xml b/pom.xml index 4663168..4a1faa8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ io.github.sanyarnd standard-paths - 1.0 + 1.0.1 https://sanyarnd.github.io/standardpaths/ jar Standard Paths - Provides cross platform access to the common directories such as AppData, Desktop or /tmp + Provides cross platform access to the common directories such as AppData, Desktop or tmp 2019 diff --git a/src/main/java/io/github/sanyarnd/standardpaths/OS.java b/src/main/java/io/github/sanyarnd/standardpaths/OS.java index d565121..2eca186 100644 --- a/src/main/java/io/github/sanyarnd/standardpaths/OS.java +++ b/src/main/java/io/github/sanyarnd/standardpaths/OS.java @@ -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; } diff --git a/src/main/java/io/github/sanyarnd/standardpaths/WindowsLocations.java b/src/main/java/io/github/sanyarnd/standardpaths/WindowsLocations.java index de09d90..4d3d213 100644 --- a/src/main/java/io/github/sanyarnd/standardpaths/WindowsLocations.java +++ b/src/main/java/io/github/sanyarnd/standardpaths/WindowsLocations.java @@ -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);