improve robustness of getCurrentSharedLibDir