Commit 6c27fc02 authored by cblu's avatar cblu
Browse files

WebFoundation:

	Fixed: 3094928 - Apply Finder bits to decoded downloads

        Reviewed by darin.

        * Misc.subproj/WebNSFileManagerExtras.h:
        * Misc.subproj/WebNSFileManagerExtras.m:
        (-[NSFileManager _web_createFileAtPath:contents:attributes:]): new, creates file and sets Finder bits.

WebKit:

	Fixed: 3094928 - Apply Finder bits to decoded downloads

        Reviewed by darin.

        * Downloads.subproj/WebDownloadHandler.m:
        (-[WebDownloadHandler createFileIfNecessary]): call _web_createFileAtPath:contents:attributes: so we set Finder bits
        * Downloads.subproj/WebMacBinaryDecoder.h:
        * Downloads.subproj/WebMacBinaryDecoder.m:
        (-[WebMacBinaryDecoder decodeData:dataForkData:resourceForkData:]): save Finder bits
        (-[WebMacBinaryDecoder fileAttributes]): return Finder bits

WebBrowser:

	Fixed: 3094928 - Apply Finder bits to decoded downloads

        Reviewed by darin.

        * DownloadRow.m:
        (-[DownloadRow _updateIconAndFilename]): no changes, moved up
        (-[DownloadRow _stopProgressAnimation]): call _updateIconAndFilename so we pick up icon changes. The Finder will update the icon after we close the file if it has the custom icon bit.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 05ae4f1e
=== WebKit-37u2 ===
2002-12-15 Chris Blumenberg <cblu@apple.com>
Fixed: 3094928 - Apply Finder bits to decoded downloads
Reviewed by darin.
* Downloads.subproj/WebDownloadHandler.m:
(-[WebDownloadHandler createFileIfNecessary]): call _web_createFileAtPath:contents:attributes: so we set Finder bits
* Downloads.subproj/WebMacBinaryDecoder.h:
* Downloads.subproj/WebMacBinaryDecoder.m:
(-[WebMacBinaryDecoder decodeData:dataForkData:resourceForkData:]): save Finder bits
(-[WebMacBinaryDecoder fileAttributes]): return Finder bits
2002-12-15 Maciej Stachowiak <mjs@apple.com>
......
......@@ -17,6 +17,7 @@
#import <WebKit/WebMacBinaryDecoder.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebNSFileManagerExtras.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
......@@ -183,8 +184,8 @@ - (WebError *)createFileIfNecessary
[response lastModifiedDate], NSFileModificationDate, nil];
}
if (![fileManager createFileAtPath:path contents:nil attributes:fileAttributes]) {
ERROR("-[NSFileManager createFileAtPath:contents:attributes:] failed.");
if (![fileManager _web_createFileAtPath:path contents:nil attributes:fileAttributes]) {
ERROR("-[NSFileManager _web_createFileAtPath:contents:attributes:] failed.");
return [self errorWithCode:WebErrorCannotCreateFile];
}
......
......@@ -17,6 +17,7 @@
#import <WebKit/WebMacBinaryDecoder.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebNSFileManagerExtras.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
......@@ -183,8 +184,8 @@ - (WebError *)createFileIfNecessary
[response lastModifiedDate], NSFileModificationDate, nil];
}
if (![fileManager createFileAtPath:path contents:nil attributes:fileAttributes]) {
ERROR("-[NSFileManager createFileAtPath:contents:attributes:] failed.");
if (![fileManager _web_createFileAtPath:path contents:nil attributes:fileAttributes]) {
ERROR("-[NSFileManager _web_createFileAtPath:contents:attributes:] failed.");
return [self errorWithCode:WebErrorCannotCreateFile];
}
......
......@@ -17,6 +17,8 @@
int _dataForkLength;
int _resourceForkLength;
u_int16_t _finderInfo;
u_int16_t _extendedFinderInfo;
u_int32_t _creationDate;
u_int32_t _modificationDate;
OSType _fileType;
......
......@@ -7,11 +7,13 @@
// This decoder decodes MacBinary II and might also work for MacBinary III.
// There's also MacBinary I, which we do not attempt to support.
#import <WebKit/WebDownloadDecoder.h>
#import <WebKit/WebMacBinaryDecoder.h>
#import "crc16.h"
#import <WebFoundation/WebAssertions.h>
#import <WebKit/WebDownloadDecoder.h>
#import <WebFoundation/WebNSFileManagerExtras.h>
#import "crc16.h"
#define HEADER_SIZE 128
......@@ -95,6 +97,12 @@ - (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceF
_resourceForkLength = (((((header[87] << 8) | header[88]) << 8) | header[89]) << 8) | header[90];
_creationDate = (((((header[91] << 8) | header[92]) << 8) | header[93]) << 8) | header[94];
_modificationDate = (((((header[95] << 8) | header[96]) << 8) | header[97]) << 8) | header[98];
_finderInfo = ((header[73] << 8) | header[101]);
_extendedFinderInfo = header[107];
// Clear reserved bits or bits not applicable after transfer as defined in Finder.h.
_finderInfo &= kColor | kIsShared | kHasCustomIcon | kIsStationery | kHasBundle | kIsAlias;
_extendedFinderInfo &= kExtendedFlagHasCustomBadge | kExtendedFlagHasRoutingInfo;
// MacBinary III.
if (header[102] == 'm' && header[103] == 'B' && header[104] == 'I' && header[105] == 'N') {
......@@ -151,6 +159,8 @@ - (NSDictionary *)fileAttributes
[NSDate dateWithTimeIntervalSinceReferenceDate:kCFAbsoluteTimeIntervalSince1904 + _modificationDate], NSFileModificationDate,
[NSNumber numberWithUnsignedLong:_fileType], NSFileHFSTypeCode,
[NSNumber numberWithUnsignedLong:_fileCreator], NSFileHFSCreatorCode,
[NSNumber numberWithUnsignedShort:_finderInfo], WebFinderInfo,
[NSNumber numberWithUnsignedShort:_extendedFinderInfo], WebExtendedFinderInfo,
nil];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment