Avoid useless char* creation

Also avoids potention segfault for crazy long filenames.