This commit is contained in:
Damiano Galassi committed 2016-11-11 18:20:25 +01:00
1 parent 200986e7f2
commit 271f70a3e4
2 files changed
+16 -14

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11535.1" systemVersion="16B2553a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16C41b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11535.1"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
@@ -29,7 +29,7 @@
<rect key="frame" x="0.0" y="0.0" width="378" height="332"/> <rect key="frame" x="0.0" y="0.0" width="378" height="332"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="21" horizontalPageScroll="10" verticalLineScroll="21" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3"> <scrollView wantsLayer="YES" autohidesScrollers="YES" horizontalLineScroll="21" horizontalPageScroll="10" verticalLineScroll="21" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<rect key="frame" x="-1" y="46" width="380" height="287"/> <rect key="frame" x="-1" y="46" width="380" height="287"/>
<clipView key="contentView" id="ix7-yM-0F6"> <clipView key="contentView" id="ix7-yM-0F6">
<rect key="frame" x="1" y="1" width="378" height="285"/> <rect key="frame" x="1" y="1" width="378" height="285"/>
+13 -11
View File
@@ -294,6 +294,8 @@
noErr = [self prepare:outError]; noErr = [self prepare:outError];
} }
NSURL *filePathURL = self.fileURL.filePathURL;
if (!noErr) { goto bail; } if (!noErr) { goto bail; }
{ {
@@ -303,10 +305,10 @@
}; };
// Check if there is enough space on the destination disk // Check if there is enough space on the destination disk
if (![self.fileURL isEqualTo:self.destURL]) { if (![filePathURL isEqualTo:self.destURL]) {
NSDictionary *dict = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(self.destURL).URLByDeletingLastPathComponent.path error:NULL]; NSDictionary *dict = [[NSFileManager defaultManager] attributesOfFileSystemForPath:self.destURL.URLByDeletingLastPathComponent.path error:NULL];
NSNumber *freeSpace = dict[NSFileSystemFreeSize]; NSNumber *freeSpace = dict[NSFileSystemFreeSize];
if (freeSpace && (self.mp4File).dataSize > freeSpace.longLongValue) { if (freeSpace && self.mp4File.dataSize > freeSpace.longLongValue) {
noErr = NO; noErr = NO;
if (outError) { if (outError) {
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space", NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space",
@@ -317,15 +319,8 @@
} }
} }
// Convert from a file reference url to a normal url
// the file will be replaced if optimized, and the reference url
// may point to nil
[self willChangeValueForKey:@"fileURL"];
_fileURL = self.fileURL.filePathURL;
[self didChangeValueForKey:@"fileURL"];
if (!self.cancelled) { if (!self.cancelled) {
if ([self.fileURL isEqualTo:self.destURL] && self.mp4File.hasFileRepresentation) { if ([filePathURL isEqualTo:self.destURL] && self.mp4File.hasFileRepresentation) {
// We have an existing mp4 file, update it // We have an existing mp4 file, update it
noErr = [self.mp4File updateMP4FileWithOptions:self.attributes error:outError]; noErr = [self.mp4File updateMP4FileWithOptions:self.attributes error:outError];
} }
@@ -362,6 +357,13 @@ bail:
self.mp4File.progressHandler = nil; self.mp4File.progressHandler = nil;
self.mp4File = nil; self.mp4File = nil;
// Convert from a file reference url to a normal url
// the file will be replaced if optimized, and the reference url
// may point to nil
[self willChangeValueForKey:@"fileURL"];
_fileURL = filePathURL;
[self didChangeValueForKey:@"fileURL"];
#ifdef SB_SANDBOX #ifdef SB_SANDBOX
if ([destination respondsToSelector:@selector(stopAccessingSecurityScopedResource)]) if ([destination respondsToSelector:@selector(stopAccessingSecurityScopedResource)])
[destination stopAccessingSecurityScopedResource]; [destination stopAccessingSecurityScopedResource];