If you have access to a disk sander, that is a good way to joint the bar, so the two rails are parallel with each other and square with the bar.
Might stop by a chainsaw shop, and ask them to joint the bar for you.
If that is a new chain (and has not hit a rock or metal), then the bar wear may be what is causing the drift. There may be a need for more work on the bar than just jointing the rails (rolling the rails tighter together).
And, if the bar and chain are not the right match for each other (chain smaller than the bar), the loose fit could cause a problem as well.