Skip to content

Conversation

@Hiroshiba
Copy link
Member

内容

electronのカレントディレクトリの変更を関数の外に出し、関数の副作用を分離しました。

その他

そもそもカレントディレクトリを変えるべきではないよなぁと感じたのでTODOコメント書いてみました。
TODOにすべきかは賛否両論な気がするので、↓にいろいろ考えを書いてみました。

@Hiroshiba Hiroshiba requested a review from a team as a code owner February 26, 2025 17:59
@voicevox-preview-pages
Copy link

voicevox-preview-pages bot commented Feb 26, 2025

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:36bf2fe

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR refactors the logic that changes Electron's current working directory by separating the side-effect from the utility function.

  • Renames the function from initializeAppPaths to getAppPaths to indicate it no longer includes side effects.
  • Moves the process.chdir call to a separate production-only code block.

Reviewed Changes

File Description
src/backend/electron/main.ts Refactors path initialization and delays the directory change call

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/backend/electron/main.ts:116

  • [nitpick] The new name 'getAppPaths' implies a pure function, but consider a name that more clearly indicates its purpose of computing paths without side effects, such as 'resolveAppPaths'.
function getAppPaths() {

Comment on lines +133 to +137
// 製品版はカレントディレクトリを.exeのパスにする
// TODO: ディレクトリを移動しないようにしたい
if (!isDevelopment) {
process.chdir(appDirPath);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

やっぱカレントディレクトリには依存しないほうが良いな~と思ったのでTODO書くのが良いかなと!
まあすぐ依存外すPR作る予定ですが。

Copy link
Member

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

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

あ~っ放置してました、ごめんなさい!

@Hiroshiba
Copy link
Member Author

レビューありがとうございます!!

@Hiroshiba Hiroshiba enabled auto-merge April 19, 2025 04:42
@Hiroshiba Hiroshiba added this pull request to the merge queue Apr 19, 2025
Merged via the queue into VOICEVOX:main with commit f5cfb69 Apr 19, 2025
11 checks passed
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.

2 participants