dont write datadir if it is False or probably None (in strange cases)

this hopefully avoids a TypeError message in rare cases on Windows