Either one should be fine. The file I edited is part of the OS install so it could potentially get replaced by an update. Using the other file to make the change is to prevent this from happening. Since the next update has this change in it already it is six of one, half a dozen of another.
I have tried both changes individually and, not surprisingly, they gave identical, but not ideal results. In both cases pressing the power button on the remote no longer causes the Pi to shutdown, as expected. However, it does cause the power menu to continually oscillate in and out at the left of the screen, which is obviously not the desired behaviour either. Since I never normally press the power button except by mistake I can live with this until the next update, it being far better than the Pi shutting down unexpectedly. But I thought I had better let @sam_nazarko know that solving one problem may have introduced another.
This will be solved with the release of Kodi v19 without need to change any files.
Test builds are already available on the forums.