Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: PyInstallerでビルドされているときのルートディレクトリ取得方法を修正 #1439

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

sabonerune
Copy link
Contributor

内容

現在PyInstallerでビルドされているときにルートディレクトリをsys.argv[0]で取得しています。
しかしこの取得方法ではシンボリックリンクから起動した場合シンボリックリンクのファイルパスになってしまいます。
ref: https://pyinstaller.org/en/v5.13.1/runtime-information.html#using-sys-executable-and-sys-argv-0

この問題は #857 で修正しましたが後にrevertされています。 #1023

このPRでファイルパスの部分だけ再度修正します。

関連 Issue

その他

他にPath(__file__).parents[2]を使用して取得する方法がありますがこの方法だとPyinstaller v6に更新するとデフォルトでは_internalディレクトリを参照するようになります。
#857_internalに入れると判断したファイルと実行ファイルのディレクトリに入れるファイルの両方がevert後にresources入っていることからsys.executableの方にしました。

@sabonerune sabonerune requested a review from a team as a code owner June 26, 2024 13:59
@sabonerune sabonerune requested review from Hiroshiba and removed request for a team June 26, 2024 13:59
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

なかなかに難しいですね。。

@Hiroshiba Hiroshiba merged commit 0fce2df into VOICEVOX:master Jun 27, 2024
4 checks passed
@sabonerune sabonerune deleted the fix/engine_root branch June 27, 2024 09:04
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.

None yet

2 participants