Skip to content

Commit

Permalink
Replace backslash path separator on Windows
Browse files Browse the repository at this point in the history
References #740.
  • Loading branch information
gaul committed Dec 14, 2024
1 parent 1e6763e commit fc92ef0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ private void listHelper(ImmutableSortedSet.Builder<StorageMetadata> builder,
var view = Files.getFileAttributeView(path, UserDefinedFileAttributeView.class);
if ((view != null && Set.copyOf(view.list()).contains(XATTR_CONTENT_MD5)) || "/".equals(delimiter)) {
var name = path.toString().substring((root.resolve(container) + "/").length());
if (path.getFileSystem().getSeparator().equals("\\")) {
name = name.replace('\\', '/');
}
logger.debug("adding prefix: {}", name);
builder.add(new StorageMetadataImpl(
StorageType.RELATIVE_PATH,
Expand All @@ -248,6 +251,9 @@ private void listHelper(ImmutableSortedSet.Builder<StorageMetadata> builder,
}
} else {
var name = path.toString().substring((root.resolve(container) + "/").length());
if (path.getFileSystem().getSeparator().equals("\\")) {
name = name.replace('\\', '/');
}
logger.debug("adding: {}", name);
var attr = Files.readAttributes(path, BasicFileAttributes.class);
var lastModifiedTime = new Date(attr.lastModifiedTime().toMillis());
Expand Down

0 comments on commit fc92ef0

Please sign in to comment.