moved function which can get dirname of symbolic link to separate file