Skip to content

Commit

Permalink
fix unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
yxnan committed Jun 17, 2023
1 parent 1472358 commit 5c5799f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 17 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
os: [ubuntu-latest, macOS-latest, windows-latest]
stack: ["2.9.3"]
ghc: ["9.2.7"]
include:
- os: ubuntu-latest
executable: nekofs-linux-x86_64
- os: macOS-latest
executable: nekofs-macos-x86_64
- os: windows-latest
executable: nekofs-windows.exe

steps:
- uses: actions/checkout@v3
Expand All @@ -39,7 +46,7 @@ jobs:
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
~\AppData\Local\Programs\stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack

- name: Install dependencies
Expand All @@ -57,9 +64,24 @@ jobs:
- name: Package
run: |
stack install --system-ghc nekofs --local-bin-path=package
mv package/nekofs* ${{ matrix.executable }}
- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Set release tag (Unix)
if: matrix.os != 'windows-latest'
run: echo "RELEASE_TAG=v$(stack --system-ghc query locals nekofs version)" >> $GITHUB_ENV

- name: Set release tag (Windows)
if: matrix.os == 'windows-latest'
run: echo "RELEASE_TAG=v$(stack --system-ghc query locals nekofs version)" >> $env:GITHUB_ENV

- name: Extract release notes
id: get_changelog
uses: ffurrer2/extract-release-notes@v1

- name: Update Release
uses: softprops/action-gh-release@v1
with:
name: nekofs-${{ runner.os }}
path: package
tag_name: ${{ env.RELEASE_TAG }}
files: ${{ matrix.executable }}
body: ${{ steps.get_changelog.outputs.release_notes }}

21 changes: 14 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## Unreleased
## [Unreleased]

## 0.1.0 - 2023-05-03
## [0.2.1] - 2023-06-12

### Added
### Fixed

- Extract (assuming compressed)
- Create (always compress)
- Optional: verify file integrity after extraction (TODO: could also add in-place verification)
- Unicode encoding of filename on `createNeko`
- Better error message on too large input

## 0.2.0 - 2023-05-08
## [0.2.0] - 2023-05-08

### Added

- Generate `files.meta` for directory or file (using `-m` option)

## [0.1.0] - 2023-05-03

### Added

- Extract (assuming compressed)
- Create (always compress)
- Optional: verify file integrity after extraction (TODO: could also add in-place verification)

2 changes: 1 addition & 1 deletion nekofs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: nekofs
version: 0.1.0
version: 0.2.1
synopsis: Create and extract nekodata files
description: Please see the README on GitHub at <https://github.com/yxnan/nekofs#readme>
category: CLI
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nekofs
version: 0.1.0
version: 0.2.1
github: "yxnan/nekofs"
license: BSD3
author: "yxnan"
Expand Down
6 changes: 3 additions & 3 deletions src/Nekodata/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Nekodata.Types
import Data.Bits
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C8
import Data.ByteString.UTF8 (fromString)
import Data.Coerce (coerce)
import Data.Word (Word32, Word8)

Expand Down Expand Up @@ -129,7 +129,7 @@ offset' = coerce . offset
-- | Convert QuasiMeta to Metadata
fromQuasiMeta :: QuasiMeta -> Metadata
fromQuasiMeta (Q fn sz csz crc _ _ ofst bcnt bszL) = Metadata
{ fileName = C8.pack fn
{ fileName = fromString fn
, tag = 2 -- ^ 2 for any compressed nekodata file
, size = ShiftedVLQ sz
, compressedSize = ShiftedVLQ csz
Expand All @@ -149,5 +149,5 @@ toBlockPos = go [BlockPos (ShiftedVLQ 0) (ShiftedVLQ 0)]
(ShiftedVLQ $ inflateOffset' p + inflateSize s)
in go (pos:posL) ss

go _ _ = undefined -- impossible
go _ _ = error "Exceeded size or file limit for nekodata files"

0 comments on commit 5c5799f

Please sign in to comment.