So the same code works on an Uno, but not on a Mega. Can you provide a link to your display and the adapter shield (if you are using one).
You will need to change the folder/files properties. Locate the file, Right click and go down to properties, at the bottom you should see a check mark next to ReadOnly, go ahead and uncheck ReadOnly, then click Apply and OK.If it still doesn't work then you will need to change the files individually. (same process)