Only modify autogenerated source files when necessary, to prevent permission problems