Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ファイル保存全般をアトミックにする
@RikitoNoto さんが #2098 で作成してくださったファイル保存を
src/helpers/fileHelper.ts
にヘルパー関数として切り出しました。それに伴い、
src/backend/electron/electronConfig.ts
のElectronConfigManager.save
src/backend/electron/main.ts
のWRITE_FILE
部分src/backend/electron/manager/RuntimeInfoManager.ts
のexportFile
関数のファイル保存処理をヘルパー関数で置き換えました。
それぞれ、
設定/ツールバーのカスタマイズ
から設定を変更し、保存ボタンを押した時にwriteFileSafelyのmoveFile呼び出しの前でelectronを停止したときにtmpファイルが存在しており、electronを再起動してファイルが正しく開ける/正しく起動できることを確認しました。
関連 Issue
ref #2103 #2098
close #2103
その他
src/backend/electron/main.ts
のWRITE_FILE
部分を非同期関数に変えてしまったのですが、こちらで問題ないでしょうか?