[lib] added 'share-cur-dir', cleaned up code