Update controller.c

solve the conflicts between "chdir" and "filepath"