add option for preferring file's directory