by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    /rgb
    @RalfBarkow_twitter
    Thanks Pathikrit. 7-Zip shows "Deflate" though with this code:
    val zipFile: File = file.zipTo("test.zip".toFile, compressionLevel = 0)
    Pathikrit Bhowmick
    @pathikrit
    yeah but don't use Int (0), you can use Deflater.DEFAULT_COMPRESSION for clarity
    /rgb
    @RalfBarkow_twitter
    Yes, thank you very much, it's really much easier to read and understand. I use 'compressionLevel = Deflater.NO_COMPRESSION' now but 7-Zip still shows "Deflate"!?
    /rgb
    @RalfBarkow_twitter
    The issue seems to be comparable to dotnet/corefx#29735 : >Currently when a ZipArchive is created and an entry is added with the CompressionLevel set to "no-compression" the file inside the archive is still wrapped in a deflate stream. The deflate stream correctly does not to compress the file.
    Pathikrit Bhowmick
    @pathikrit
    But is this a bug in better-file? It seems its a bug in the unzipper ... unzip works just fine from command line..
    /rgb
    @RalfBarkow_twitter
    unzip -lv test.zip shows the method as Defl:N and not as Stored, so it might be a bug in better-file. (Implicits.scala, line 258: if (level == Deflater.NO_COMPRESSION) out.setMethod(ZipOutputStream.DEFLATED) seems to wrap the file inside the archive in a deflate stream.
    Pathikrit Bhowmick
    @pathikrit
    @RalfBarkow_twitter : That code was added here for some reason - https://github.com/pathikrit/better-files/pull/38/files
    Can you send a pull request perhaps or atleast file an issue with failing test case?
    /rgb
    @RalfBarkow_twitter
    Thanks Pathikrit, will try to write a failing test case and file an issue then but unfortunately I won't be able to do it in the near future (next week is carnival).
    Pathikrit Bhowmick
    @pathikrit
    A failing test or same is enough and I can fix it
    /rgb
    @RalfBarkow_twitter
    Thanks Pathikrit, my problem seems to be that I don't know how to specify the compression method for an individual ZIP file entry, and set it to STORED. (Btw I'm working on that "failing test or same".)
    Pathikrit Bhowmick
    @pathikrit
    Thanks!
    Just put what your "ideal API" would look like and I can work backwords from there
    /rgb
    @RalfBarkow_twitter
    How about val zipFile: File = file.zipTo("test.iirds").toFile.stored ?
    Pathikrit Bhowmick
    @pathikrit
    What does .stored mean?
    /rgb
    @RalfBarkow_twitter
    It should set the compression method to STORED.
    /rgb
    @RalfBarkow_twitter
    val zipFile: File = file.zipTo("test.iirds".toFile).setCompressionMethod(STORED)
    /rgb
    @RalfBarkow_twitter
    According to https://en.wikipedia.org/wiki/Zip_(file_format)#Compression_methods , the .ZIP File Format Specification documents the following compression methods: Store (no compression), ...
    I would like to use .store to specify the compression method for an individual ZIP file entry, and set it to STORED.
    /rgb
    @RalfBarkow_twitter
    Pathikrit Bhowmick
    @pathikrit
    Ok thanks for the pointer. Will take a look
    Philippe Derome
    @phderome
    I am curious to see whether creating tar balls or extracting them is within mandate or roadmap of this library or whether people have pointers for this (other than Process API or haoyi's os API which work well).
    Is there any plan or consideration to include setfacl and getfacl interfaces to handle more complex permission schemes than what chmod allows?
    Pathikrit Bhowmick
    @pathikrit
    @phderome : Is tar balls is definately in scope of this project. Can you file an issue? PRs welcome too :)
    Philippe Derome
    @phderome
    I don't really feel up to the task to contribute to be honest. I'll submit issue. I heard that tar technically is GNU and not completely UNIX portable. I assume that it does not bother you or won't stop you.
    Philippe Derome
    @phderome
    so I see you noticed today it was a duplicate...
    Bloznelis
    @Bloznelis
      def canonicalPath: String =
        toJava.getAbsolutePath
    Hello, is this intended?
    since cannonicalFile is expressed like this:
      def canonicalFile: File =
        toJava.getCanonicalFile.toScala
    Pathikrit Bhowmick
    @pathikrit
    @Bloznelis : yes that is intended
    Sait Sami Kocataş
    @Deliganli

    hi Guys

    when I give a config string like below

    File("~/some/directory")

    it outputs;
    in windows: C:\Users\myuser\projects\myproject\~\some\directory
    in linux : /home/myuser/projects/myproject/~/some/directory

    I would expect it to output;
    in windows: C:\Users\myuser\some\directory
    in linux: /home/myuser/some/directory

    but File.home is pointing to correct directory
    projects/myproject is the classpath of the running application

    am I doing something wrong?

    Pathikrit Bhowmick
    @pathikrit
    @Deliganli : ~ is not a standard construct. Try File.currentWorkingDirectory / "some" / "directory"
    Sait Sami Kocataş
    @Deliganli

    @pathikrit thanks

    I needed to implement something for my usage below

    val PathRegex = """^(?:\~\/)(\.?.*)""".r
    
      implicit class FileAugmentations(file: String) {
    
        def toFile: File = file match {
          case PathRegex(paths) =>
            File.home / paths
          case absolute =>
            File(absolute)
        }
      }

    issue is I will be getting the strings from config files so cannot use code until I reason with the string

    Pathikrit Bhowmick
    @pathikrit
    @Deliganli : Yes it won't work. I don't think it is a issue with better-files but the JDK itself. Try using vanilla java.io.File or java.nio.Path and see if it works there? If yes, let me know ...
    iOgre
    @iOgre_gitlab
    Greetings!
    Why File("zzz").changeExtensionTo("ddd").name gives "zzz" and not "zzz.ddd" ?
    Pathikrit Bhowmick
    @pathikrit
    Because zzz does not have a extension already - I think you are right - this should give zzz.ddd
    vimalaguti
    @vimalaguti
    Hi, I'm generating the scala api documentation for my project, but the better-files api documentation is getting also included. Any idea on how to remove it from my project-doc?
    Pathikrit Bhowmick
    @pathikrit
    @vimalaguti: You mean scaladoc is being generated? If you add better-files as a sbt dependency instead of copying it, it should not happen
    vimalaguti
    @vimalaguti
    better-files is a dependency, when I generate the scaladoc for my project I also found the better-files' one
    Pathikrit Bhowmick
    @pathikrit
    @vimalaguti : can you post your build file and/or file an issue on github with better-files? this is strange
    vimalaguti
    @vimalaguti
    i'll try to open an issue with the above infos, thank you
    Tomas Klubal
    @blondacz
    Hello, can u pls tell me how do I read a zip file with one entry from classpath and map it to string? Thx
    Pathikrit Bhowmick
    @pathikrit
    @blondacz : What do you mean by mapping to String?
    Eric Peters
    @er1c
    @pathikrit got a few PRs put in, not sure what you prefer, bigger or smaller PRs? should I ask you about features before submitting a PR?
    Pathikrit Bhowmick
    @pathikrit
    Smaller PRs and yeah feel free to message me
    Eric Peters
    @er1c
    What's up with the CI, seems like it just keeps running lol
    Eric Peters
    @er1c
    Draft PR for a bunch of IO stuff: pathikrit/better-files#431