Save xattr encoding to empty file

This commit is contained in:
1024jp 2015-07-15 14:26:34 +09:00
parent 4d5151f359
commit ab0bea814a
2 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ develop
- Move scripts folder location from `~/Library/Application Support/CotEditor/ScriptMenu/` to `~/Library/Application Scripts/com.coteditor.CotEditor/` because of the Sandbox requirement.
- Users need to migrate their script to the new folder manually, since CotEditor doesn't have the write permisson to the new location.
- Set access-group `com.coteditor.CotEditor.edit` to CotEditor's script definition.
- Change behavior to save `com.apple.TextEncoding` xattr on saving if the file had no content.

View File

@ -195,7 +195,7 @@ NSString *const CEIncompatibleConvertedCharKey = @"convertedChar";
NSStringEncoding xattrEncoding = [self fileURL] ? [[self fileURL] getAppleTextEncoding] : NSNotFound;
// don't save xattr if file doesn't have it in order to avoid saving wrong encoding (2015-01 by 1024jp).
[self setShouldSaveXattr:(xattrEncoding != NSNotFound)];
[self setShouldSaveXattr:(xattrEncoding != NSNotFound) || ([data length] == 0)];
return [self readStringFromData:data encoding:[self readingEncoding] xattrEncoding:xattrEncoding];
}