Skip to content

Commit

Permalink
try to not set posix file perms on windows - for #123
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesward committed Nov 8, 2023
1 parent 34236d5 commit 1ad93f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/webjars/WebJarExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.PosixFilePermission;
import java.util.Map;
import java.util.Scanner;
Expand Down Expand Up @@ -143,7 +144,7 @@ private static void extractResource(@Nonnull String webJarName, @Nonnull WebJarI
Files.copy(inputStream, newFile.toPath());
inputStream.close();
Set<PosixFilePermission> resourcePerms = resource.getPosixFilePermissions();
if (resourcePerms != null) {
if (resourcePerms != null && Files.getFileStore(newFile.toPath()).supportsFileAttributeView(PosixFileAttributeView.class)) {
Files.setPosixFilePermissions(newFile.toPath(), resourcePerms);
}
if (resource.getLastModified() > 0) {
Expand Down

0 comments on commit 1ad93f2

Please sign in to comment.