Skip to content

Fix: use AppDomain.BaseDirectory and fix timestamp hh→HH in SimulatorMainTask#35

Open
HashidaTKS wants to merge 1 commit intomasterfrom
fix/simulator-main-task-relative-path
Open

Fix: use AppDomain.BaseDirectory and fix timestamp hh→HH in SimulatorMainTask#35
HashidaTKS wants to merge 1 commit intomasterfrom
fix/simulator-main-task-relative-path

Conversation

@HashidaTKS
Copy link
Copy Markdown
Owner

問題点

SimulatorMainTask.GetResultFilePaths() に2つのバグがあった。

1. 相対パス "." の使用(line 80)

Path.Combine(".", "SimulationResult", ...) はプロセスの作業ディレクトリに依存するため、アプリケーションの起動方法によって保存先が変わる。

2. タイムスタンプの hh(12時間制)使用(line 76)

DateTime.Now.ToString("yyyyMMddhhmmss")hh は12時間表記(01〜12)のため、午前9時と午後9時が同じ文字列 09 になり、ファイル名が重複する可能性があった。

改善内容

  • Path.Combine(".", ...)Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ...) に変更
  • "yyyyMMddhhmmss""yyyyMMddHHmmss" に変更(HH = 24時間制 00〜23)

Test plan

  • シミュレーション結果ファイルがアプリケーションの実行ディレクトリ配下に保存されることを確認
  • 午前と午後で同じ時刻でもファイル名が重複しないことを確認

🤖 Generated with Claude Code

…mat hh→HH

Two bugs in GetResultFilePaths:
1. Path.Combine(".", ...) depends on the process working directory, which
   can vary by launch method. Use AppDomain.CurrentDomain.BaseDirectory to
   always resolve paths relative to the application's executable location.
2. The timestamp format "yyyyMMddhhmmss" used lowercase hh (12-hour clock,
   01-12), which can produce duplicate file names for times that are 12 hours
   apart (e.g. 09:00 AM and 09:00 PM both produce "09"). Change to uppercase
   HH (24-hour clock, 00-23) to ensure unique timestamps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant