Skip to content

How to preserve file permissions using packDirRecur #66

@saurabhnanda

Description

@saurabhnanda

The following is not working as I am expecting it to. Am I doing anything wrong?

prepareZipFile :: FilePath -> IO FilePath
prepareZipFile dir = do
  Zip.createArchive zipFileName $ Zip.packDirRecur Zip.Deflate createSelector dir
  pure zipFileName
  where
    zipFileName = "/tmp/upload.zip"

    createSelector fpath = do
      s <- Zip.mkEntrySelector fpath
      Zip.setExternalFileAttrs ((0x100000 .|. 0o0755) `shiftL` 16) s
      -- fmode <- liftIO $ (fmap Unix.fileMode $ Unix.getFileStatus $ dir <> "/" <> fpath)
      -- Zip.setExternalFileAttrs (traceShowId $ fromIntegral $ (toInteger fmode) `shiftL` 16) s
      pure s

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions