Fix writing relative file path if project path contains . or .. (pull request #1278)