To fly in a straight line would imply a purposeful destination, which a fly, under most cricumstances would not have. They, like all other insects and animals are primarily using their various modes of transporting themselves as a means to forage. Flies have a well developed sense of smell and during their flight are, undoubtedly, constantly turning to zero in on the source of smells for food...
Bees, on the other hand, also meander when searching for nectar, also attracted by smells, but upon reaching their maximum load capability fly in nearly a straight line back to the hive. They, then inform their hive sisters of the location of the pollen and nectar, to whcih those bees also fly in a straight line... bee-line, so to speak...