Przeglądaj źródła

maybe this time

Kajetan Johannes Hammerle 2 lat temu
rodzic
commit
5029612c3d

+ 8 - 2
src/me/hammerle/snuviscript/code/FunctionRegistry.java

@@ -361,12 +361,18 @@ public class FunctionRegistry {
             Path p = Paths.get(((File) in[0].get(sc)).toURI());
             Files.write(p, ((List<Object>) in[1].get(sc)).stream().map(o -> String.valueOf(o))
                     .collect(Collectors.toList()), StandardCharsets.UTF_8);
-            Files.setPosixFilePermissions(p, FILE_ACCESS);
+            try {
+                Files.setPosixFilePermissions(p, FunctionRegistry.FILE_ACCESS);
+            } catch(Exception ex) {
+            }
         });
         registerConsumer("file.createfolder", (sc, in) -> {
             Path p = Paths.get(((File) in[0].get(sc)).toURI());
             Files.createDirectory(p, PosixFilePermissions.asFileAttribute(FILE_ACCESS));
-            Files.setPosixFilePermissions(p, FILE_ACCESS);
+            try {
+                Files.setPosixFilePermissions(p, FunctionRegistry.FILE_ACCESS);
+            } catch(Exception ex) {
+            }
         });
         registerFunction("config.new",
                 (sc, in) -> new SnuviConfig(in[0].getString(sc), in[1].getString(sc)));

+ 4 - 1
src/me/hammerle/snuviscript/config/SnuviConfig.java

@@ -97,7 +97,10 @@ public class SnuviConfig {
                 }
                 return String.format("%s=%s", e.getKey(), e.getValue());
             }).collect(Collectors.toList()), StandardCharsets.UTF_8);
-            Files.setPosixFilePermissions(p, FunctionRegistry.FILE_ACCESS);
+            try {
+                Files.setPosixFilePermissions(p, FunctionRegistry.FILE_ACCESS);
+            } catch(Exception ex) {
+            }
             return true;
         } catch(UnsupportedOperationException ex) {
             print(sc, "an unsupported operation was used", ex);