If longer than MAX_PATH, try to shorten it to reduce crash

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>