Skip to content

v4.0c Windows & Linux

Choose a tag to compare

@YadeWira YadeWira released this 28 Apr 22:21
· 9 commits to master since this release

Feature add on top of v4.0b.

New flag: -fs

Preserve source folder structure under -od<DIR> when -r expands a directory. Mirrors caesium-clt's -RS semantics.

> packJPG a -r -fs -odOUT TILIN

TILIN/top.jpg            →  OUT/top.pjg
TILIN/sub/in_sub.jpg     →  OUT/sub/in_sub.pjg
TILIN/sub/deep/x.jpg     →  OUT/sub/deep/x.pjg

(TILIN's basename itself is stripped — caesium semantics. The output dir contains TILIN's contents in mirrored layout.)

Without -fs, behaviour is identical to v4.0b (flat output under -od).

Why

When -r <SRCDIR> and -od<OUT> are combined, today every output file lands flat in OUT/. Two siblings with the same basename in different subdirs collide silently. -fs fixes that by mirroring the relative path of each file.

Implementation

  • New parallel global filelist_srcroot[], allocated alongside filelist[]. Indexed by the same file_no every worker uses.
  • collect_files_recursive emits pairs (path, src_root) so the caller can populate the parallel array when -r is expanded. Direct CLI path args keep src_root = NULL.
  • create_filename adds a branch: when fs_mode && outdir && filelist_srcroot[file_no] != NULL, it computes relative(parent(base), src_root) and inserts that subdir between outdir and the basename. Intermediate dirs are created on demand.
  • CLI parser recognizes -fs. Help text updated.

C-linkage packjpglib_* API

Unchanged. Those entry points bypass create_filename and filelist/filelist_srcroot entirely — they operate on caller-provided in-memory buffers. Consumers that link packJPG as a static library (e.g. syc) are unaffected.

Validation

3-file tree (top.jpg + sub1/in_sub1.jpg + sub2/deep/buried.jpg):

flags output layout
-r -odOUT (no -fs) flat — OUT/{top,in_sub1,buried}.pjg
-r -fs -odOUT mirrored — OUT/{top.pjg, sub1/in_sub1.pjg, sub2/deep/buried.pjg}

PJG byte payloads are identical between the two modes for matching files. Format unchanged.

Legacy Windows builds

The sourcelegacy/ build (Windows XP/Vista/7/8) is not included in this feature. Per the project's "community-maintained, frozen at v4.0 format" policy, legacy stays at v4.0b feature-wise. The legacy binaries shipped here still run identically to v4.0b — they just don't have -fs. Modern Windows users get the full v4.0c feature set.

Compatibility

PJG file format unchanged. Files produced by v3.x / v4.x decode unchanged with v4.0c, and vice versa for files that don't exercise -fs at all.

Downloads

  • packJPG_linux_x64 — Linux x86_64 (modern, with -fs)
  • packJPG_win_x64.exe — Windows x86_64 (modern, with -fs)
  • packJPG_win_legacy_x64.exe — Windows XP/Vista/7/8 64-bit (community-maintained, v4.0b feature set, no -fs)
  • packJPG_win_legacy_x86.exe — Windows XP/Vista/7/8 32-bit (community-maintained, v4.0b feature set, no -fs)