Add ChangeCurrentDir function

modify AddMagicComment function