Looking at the last version of that patch, I don't think it'll be 100% good.
I should agree that I didn't test it fully. That's why I wrote that I need to do clean-up before I commit.
For example, the "keep the backup file" bit will keep it renamed as tempfile, if I read the patch correctly.
I need to look into this.
The Windows-specific workaround for the broken readonly flag is now enabled on all platforms, which doesn't do much harm, but I don't understand what it's for
I'll restore original behaviour.
Also, I'm not sure if copy-write-replace can cope with rename-write-replace performance-wise.
I don't think so. There are two write operations in both the cases; in the present code & in my patch.
1. In the present code it's write and then replace.
2. In the new patch, it's copy and then write. But there is no replace.
So I don't think it'll affect the performance.
I'm not sure about that BOM story and tinyxml either. It may be that I just chose "non-BOM" back in the old days because it wasn't needed, or it may be that there was a problem, I don't remember... so long ago.
BOM story is applicable while certain encodings are used. If BOM is used, detection of encoding becomes much faster.
This new
Save() routine was added to save multi-byte encoded files properly. IIRC, the Non-BOM routine used to fail to save multi-byte encoded files properly in many cases.
Also note that the
Save() routine without BOM still contains old code. I haven't touched it while I made changes to improve Unicode support.
You must be sure that this doesn't break project files and config files (so please test before changing that).
IIRC, they still uses old code; that's the
Save() routine without BOM one. I didn't touch this code earlier.
I'm not in a hurry to apply this patch as it involves a critical portion of C::B. I'll post a better patch here so that other users may comment on it before I commit it.