Skip to content

用入口脚本的真实路径获取工作目录位置#27

Open
hyx0329 wants to merge 1 commit intohiroi-sora:mainfrom
hyx0329:main
Open

用入口脚本的真实路径获取工作目录位置#27
hyx0329 wants to merge 1 commit intohiroi-sora:mainfrom
hyx0329:main

Conversation

@hyx0329
Copy link
Copy Markdown

@hyx0329 hyx0329 commented May 15, 2025

修改后可以将入口脚本链接到任意位置(例如 $HOME/.local/bin)而保持程序正常工作。

另含两点次要改动:

  • 切换文件目录改用pushd/popd,在Python环境加载完成后回到执行指令的目录。目的是保持命令行模式下相对路径(与 --path 一同使用)仍然正确。
    • 不过考虑到目前 Linux 平台上 Umi-OCR 还无法在数据目录之外正常运行、既有的python wrapper也会切换工作目录,整体仍不支持传入相对路径。
  • 使用exec调用python wrapper,替换掉当前已经完成使命的bash主进程。

The entry script and app directory can be linked to anywhere now. The
previous implementation will break if the entry script alone is linked
somewhere else.

The new implementation also prepares for passing relative image file
path to the program.

'exec' is used to replace the wrapper script process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant