I would not say this is a safe replace. File might contain backslash on Linux. I'd rather like to see replace(PATH_SEPARATOR, "/") here :-)