-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Sineaggi/remove-guava
Remove guava
- Loading branch information
Showing
12 changed files
with
55 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 14 additions & 9 deletions
23
src/main/java/org/cryptomator/frontend/fuse/locks/FilePaths.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
package org.cryptomator.frontend.fuse.locks; | ||
|
||
import com.google.common.base.Joiner; | ||
import com.google.common.base.Splitter; | ||
import org.jetbrains.annotations.Unmodifiable; | ||
|
||
import java.util.List; | ||
import java.util.function.Predicate; | ||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
class FilePaths { | ||
|
||
private static final char PATH_SEP = '/'; | ||
private static final String PATH_SEP = "/"; | ||
private static final String ROOT = ""; | ||
private static final Splitter PATH_SPLITTER = Splitter.on(PATH_SEP).omitEmptyStrings(); | ||
private static final Joiner PATH_JOINER = Joiner.on(PATH_SEP); | ||
private static final Pattern PATH_REGEX = Pattern.compile(PATH_SEP); | ||
|
||
@Unmodifiable | ||
public static List<String> toComponents(String pathRelativeToRoot) { | ||
return Stream.concat(Stream.of(ROOT), PATH_SPLITTER.splitToStream(pathRelativeToRoot)).toList(); | ||
return Stream.concat(Stream.of(ROOT), PATH_REGEX | ||
.splitAsStream(pathRelativeToRoot) | ||
.filter(Predicate.not(String::isEmpty))).toList(); | ||
} | ||
|
||
public static String toPath(List<String> pathComponents) { | ||
return PATH_JOINER.join(pathComponents); | ||
return String.join(PATH_SEP, pathComponents); | ||
} | ||
|
||
public static List<String> parentPathComponents(List<String> pathComponents) { | ||
assert pathComponents.size() > 0; | ||
assert !pathComponents.isEmpty(); | ||
return pathComponents.subList(0, pathComponents.size() - 1); | ||
} | ||
|
||
public static String normalizePath(String path) { | ||
return ROOT + PATH_SEP + PATH_JOINER.join(PATH_SPLITTER.split(path)); | ||
return ROOT + PATH_SEP + PATH_REGEX | ||
.splitAsStream(path) | ||
.filter(Predicate.not(String::isEmpty)) | ||
.collect(Collectors.joining(PATH_SEP)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters