Skip to content

Prefer portable output directory in standalone builds (スタンドアロン版でポータブル出力ディレクトリを優先)#22

Merged
maple60 merged 1 commit into
fix/output-path-standalone-appfrom
codex/add-output-folder-for-standalone-app
Apr 2, 2026
Merged

Prefer portable output directory in standalone builds (スタンドアロン版でポータブル出力ディレクトリを優先)#22
maple60 merged 1 commit into
fix/output-path-standalone-appfrom
codex/add-output-folder-for-standalone-app

Conversation

@maple60
Copy link
Copy Markdown
Owner

@maple60 maple60 commented Apr 2, 2026

Motivation

  • Allow standalone/frozen applications to create an output/ directory next to the app/executable when that location is writable to match user expectations.
  • Avoid failures when the app is installed in protected locations by falling back to a user-writable data directory.
  • Clarify the behavior in both English and Japanese documentation.

Description

  • Added _frozen_portable_base_dir() to compute a portable base directory near sys.executable, including .app bundle handling on macOS.
  • Updated get_output_base_dir() to prefer the portable base for frozen apps when _is_writable_dir() returns true and otherwise fall back to the OS user data directory returned by user_data_dir().
  • Kept development-mode behavior unchanged (use repository root when writable).
  • Documented the new standalone behavior in README.md and README_ja.md.

Testing

  • Verified syntax by compiling src/leaf_contour_efd/utils/paths.py using PYENV_VERSION=3.11.14 python -m compileall, which succeeded.
  • Observed an initial compile attempt failed due to the environment .python-version not matching an installed Python, which is an environment issue and not a code error.
  • Confirmed the modified files src/leaf_contour_efd/utils/paths.py, README.md, and README_ja.md were updated.

(Japanese)

Motivation

  • スタンドアロン/frozen ビルド時に、書き込み可能ならアプリ/実行ファイルと同じ階層に output/ を作成できるようにするためです。
  • インストール先が保護された場所でも安全に動作するよう、書き込み不可の場合はユーザーデータ領域へフォールバックします。
  • 英語・日本語の README に挙動を追記して利用者に明示します。

Description

  • sys.executable の近傍をベースにする _frozen_portable_base_dir() を追加し、macOS の .app バンドルも考慮します。
  • get_output_base_dir() を変更して、frozen 時はまずポータブルなベースを試し書き込み可であればそれを返し、不可ならユーザーデータ領域へフォールバックするようにしました。
  • 開発モード(リポジトリルートを優先)は従来どおり維持しています。
  • README.mdREADME_ja.md にスタンドアロンでの振る舞いを追記しました。

Testing

  • PYENV_VERSION=3.11.14 python -m compileall src/leaf_contour_efd/utils/paths.py により構文チェックを行い成功しました。
  • 最初の python -m compileall 実行は環境の .python-version とインストール済み Python が一致せず失敗しましたが、これは環境依存の問題でコード不備ではありません。
  • 変更ファイルは src/leaf_contour_efd/utils/paths.pyREADME.mdREADME_ja.md です。

Codex Task

@maple60 maple60 merged commit 32142a4 into fix/output-path-standalone-app Apr 2, 2026
7 checks passed
@maple60 maple60 deleted the codex/add-output-folder-for-standalone-app branch April 2, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant