better-resources
instead of adding to better.files.resources
, not sure if you have an initial impression? There is definitely some overlap on compression stuff, I haven't had a chance yet to see how much can be refactored
Hello 👋 I'm writing a small library and I'm trying to read .json
resource files without knowing the names of all the files in advance. It works fine locally but when I publish the library and call it from another application I get errors like: java.nio.file.FileSystemNotFoundException
. This is how I'm finding the files currently:
private val dir = File(Resource.getUrl("property.json"))
private val matches: Iterator[File] = dir.parent.glob("**/*.json", includePath = false)
Any help would be much appreciated!
Hello everyone : ) this is my first time using better-files
, so apologies in advance if the question is too basic.
My main objective is to write JSON lines to a file efficiently while maintaining referential transparency (nice to have).
I have two main questions:
I have created some sample code to show what I have reached so far in my code (only a snippet):
import io.circe.generic.auto._, io.circe.syntax._
for (u <- someList) println(u.asJson.noSpaces)
// resulting Json (sample):
// {"id":"1","name":"Mr Foo","roles":["Chief Foo Officer"],"phone_number":null}
// {"id":"2","name":"Mr Bar","roles":["Chief Bar Officer"],"phone_number":null}
// .....
IO
. Here is an example: import better.files._
import cats.effect._
def write(file: File, lines: List[String]): IO[Unit] = IO {
for {
writer <- file.printWriter()
line <- lines
} writer.println(line)
}
val defaultFolderPermissions = Set[PosixFilePermission](PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE
, PosixFilePermission.GROUP_READ, PosixFilePermission.GROUP_EXECUTE)
file.setPerms(" u-x,u+rwX,g-wx,g+rX,o-rwx")
(or with the binary representation) ?
something like
file.setPerms(" u-x,u+rwX,g-wx,g+rX,o-rwx")
(or with the binary representation) ?
That is in the Unix dsl. See line 149: https://github.com/pathikrit/better-files/blob/master/core/src/main/scala/better/files/Dsl.scala#L149
Hi, Pathikrit! Sorry for the off-topic... Could you, please, take part in a discussion about releasing the Dijon library? pathikrit/dijon#63
Sorry for some reason I had all dijon notifications muted. Let me transfer the library to someone else? Happy to work through it now...
Hi,
Have anybody here experienced problems with the file monitor on windows?
I have used the akka file watcher with better-files 3.6.0 on many systems for many months without problems,
but in my latest release I updated to scala 2.13 with better-files 3.9.1 and now it doesn't work anymore.
It works if you watch a few folders but on my systems I watch 10-30 folders, some with 100k+ child folders.
This used to work in 3.6.0 but not in the newer releases.