nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
242 stars 146 forks source link

Fix track sorting for dynamic ptracks on windows #1224

Closed rtownson closed 1 day ago

rtownson commented 5 days ago

Fix track sorting used for dynamic .ptracks files containing time indices. Usually the original .ptracks file is overwritten by the sorted one, but on Windows file deletion may be blocked. As a workaround for this situation, the sorted .ptracks file is left as a separate file (only when it's not possible to do the deletion).

Side note: anywhere we use std::remove() or std::rename() may fail on Windows due to restricted permissions, we should be careful about checking that it succeeded.