mirror of
https://github.com/koreader/koreader.git
synced 2026-11-28 16:25:59 +00:00
The previous handling had two problems: - current dir only appended if argc == 1 - multiple args passed as one to reader.lua As a result: - `bin/koreader -v -d` doesn't work (reader.lua sees it as one arg) - `bin/koreader -d abc.epub` doesn't work either (for the same reason) The fix is to go through args one by one and use `set -- …` to keep them as an array of args (preserves white-space and avoid unintended expansions that might happen if we attempted to do some eval trickery instead). Note that reader.lua doesn't currently handle multiple file/dir args, so we could instead just look at the last arg and add pwd to that one. Unfortunately doing this in POSIX sh isn't any simpler than processing all args. :-) (While at it, use `$PWD` which is required by POSIX to always be present.) Tested with bash 5.3.9, busybox 1.37.0 and dash 0.5.12.