-
Notifications
You must be signed in to change notification settings - Fork 346
refactor: electronのカレントディレクトリの変更のロジックを関数の外に出す #2569
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
refactor: electronのカレントディレクトリの変更のロジックを関数の外に出す #2569
The head ref may contain hidden characters: "chore--electron\u306E\u30AB\u30EC\u30F3\u30C8\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5909\u66F4\u306E\u30ED\u30B8\u30C3\u30AF\u3092\u5171\u901A\u5316"
Conversation
|
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
There was a problem hiding this 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() {
| // 製品版はカレントディレクトリを.exeのパスにする | ||
| // TODO: ディレクトリを移動しないようにしたい | ||
| if (!isDevelopment) { | ||
| process.chdir(appDirPath); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
やっぱカレントディレクトリには依存しないほうが良いな~と思ったのでTODO書くのが良いかなと!
まあすぐ依存外すPR作る予定ですが。
sevenc-nanashi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ~っ放置してました、ごめんなさい!
|
レビューありがとうございます!! |
内容
electronのカレントディレクトリの変更を関数の外に出し、関数の副作用を分離しました。
その他
そもそもカレントディレクトリを変えるべきではないよなぁと感じたのでTODOコメント書いてみました。
TODOにすべきかは賛否両論な気がするので、↓にいろいろ考えを書いてみました。