Does this work if the source_file is specified without any path (not even an implicit ./) ?
Do we care about speed here ?  If so, it'd be better to locate the relevant PATH_SEPARATOR in soruce_file and copy just the part up to that, rather than all of source_file, into path[].