copy the path into a char array to avoid buffer corruption
use copy constructors for string arguments to avoid using object past their lifespans