summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/English.lproj/Preferences.xib66
-rw-r--r--macosx/HBAppDelegate.m95
-rw-r--r--macosx/HBJobOutputFileWriter.m11
-rw-r--r--macosx/HBOutputFileWriter.m6
-rw-r--r--macosx/HBOutputPanelController.m27
-rw-r--r--macosx/HBPreferencesController.m1
-rw-r--r--macosx/HBPreviewGenerator.m17
-rw-r--r--macosx/HBQueueController.m2
-rw-r--r--macosx/HBUtilities.h5
-rw-r--r--macosx/HBUtilities.m13
10 files changed, 120 insertions, 123 deletions
diff --git a/macosx/English.lproj/Preferences.xib b/macosx/English.lproj/Preferences.xib
index f6abd81a0..d68b90d3c 100644
--- a/macosx/English.lproj/Preferences.xib
+++ b/macosx/English.lproj/Preferences.xib
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C99d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7515.2" systemVersion="14D72i" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6724"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7515.2"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HBPreferencesController">
@@ -379,14 +379,15 @@
</textFieldCell>
</textField>
</subviews>
+ <point key="canvasLocation" x="-82" y="-791"/>
</customView>
<customView id="236" userLabel="Advanced">
- <rect key="frame" x="0.0" y="-3" width="500" height="290"/>
+ <rect key="frame" x="0.0" y="-5" width="500" height="308"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<popUpButton verticalHuggingPriority="750" id="363">
- <rect key="frame" x="284" y="62" width="66" height="22"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <rect key="frame" x="218" y="101" width="66" height="22"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<popUpButtonCell key="cell" type="push" title="1" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="369" id="364">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -403,8 +404,8 @@
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" id="387">
- <rect key="frame" x="337" y="249" width="76" height="22"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <rect key="frame" x="337" y="267" width="76" height="22"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<popUpButtonCell key="cell" type="push" title="0.25" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="391" id="388">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -437,7 +438,7 @@
</connections>
</button>
<button id="398">
- <rect key="frame" x="125" y="120" width="339" height="18"/>
+ <rect key="frame" x="125" y="138" width="339" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="check" title="Use libdvdnav (instead of libdvdread)" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="399">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -448,7 +449,7 @@
</connections>
</button>
<button id="347">
- <rect key="frame" x="125" y="86" width="340" height="18"/>
+ <rect key="frame" x="125" y="83" width="340" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="check" title="Put individual encode logs in same location as movie" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="348">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -459,7 +460,7 @@
</connections>
</button>
<textField verticalHuggingPriority="750" id="442">
- <rect key="frame" x="18" y="122" width="104" height="14"/>
+ <rect key="frame" x="18" y="140" width="104" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="DVD-Video:" id="443">
<font key="font" metaFont="smallSystem"/>
@@ -468,7 +469,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="IV7-SY-HLR">
- <rect key="frame" x="18" y="195" width="104" height="14"/>
+ <rect key="frame" x="18" y="213" width="104" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Scan:" id="c0L-TU-WML">
<font key="font" metaFont="smallSystem"/>
@@ -477,7 +478,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="jPa-4p-Y29">
- <rect key="frame" x="18" y="254" width="104" height="14"/>
+ <rect key="frame" x="18" y="272" width="104" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="x264:" id="cqp-xU-GOe">
<font key="font" metaFont="smallSystem"/>
@@ -486,7 +487,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="350">
- <rect key="frame" x="18" y="88" width="104" height="14"/>
+ <rect key="frame" x="18" y="106" width="104" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Log:" id="351">
<font key="font" metaFont="smallSystem"/>
@@ -495,16 +496,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="371">
- <rect key="frame" x="101" y="67" width="180" height="14"/>
+ <rect key="frame" x="120" y="106" width="95" height="14"/>
<autoresizingMask key="autoresizingMask"/>
- <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Activity Log Verbosity Level:" id="372">
+ <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Verbosity Level:" id="372">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="359">
- <rect key="frame" x="92" y="171" width="230" height="14"/>
+ <rect key="frame" x="92" y="189" width="230" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Number of picture previews to scan:" id="360">
<font key="font" metaFont="smallSystem"/>
@@ -513,7 +514,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="463">
- <rect key="frame" x="118" y="195" width="179" height="14"/>
+ <rect key="frame" x="118" y="213" width="179" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Minimum length of title to scan:" id="464">
<font key="font" metaFont="smallSystem"/>
@@ -522,7 +523,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="UXr-op-aKN">
- <rect key="frame" x="356" y="195" width="77" height="14"/>
+ <rect key="frame" x="356" y="213" width="77" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="seconds" id="klQ-DW-Kc6">
<font key="font" metaFont="smallSystem"/>
@@ -531,7 +532,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="395">
- <rect key="frame" x="118" y="254" width="216" height="14"/>
+ <rect key="frame" x="118" y="272" width="216" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Constant Quality fractional granularity:" id="396">
<font key="font" metaFont="smallSystem"/>
@@ -540,8 +541,8 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="480">
- <rect key="frame" x="303" y="193" width="48" height="19"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <rect key="frame" x="303" y="211" width="48" height="19"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="481">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -552,8 +553,8 @@
</connections>
</textField>
<button id="ybi-46-yhY">
- <rect key="frame" x="126" y="229" width="286" height="20"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <rect key="frame" x="125" y="247" width="286" height="20"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="check" title="Show Advanced Encoder Options Tab" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="Du1-9x-nHn">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -570,15 +571,15 @@
<font key="titleFont" metaFont="system"/>
</box>
<box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="I0V-hM-Fq0">
- <rect key="frame" x="20" y="150" width="460" height="5"/>
+ <rect key="frame" x="20" y="168" width="460" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<popUpButton verticalHuggingPriority="750" id="352">
- <rect key="frame" x="325" y="166" width="73" height="22"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <rect key="frame" x="325" y="184" width="73" height="22"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="353">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -618,8 +619,19 @@
<binding destination="61" name="selectedValue" keyPath="values.PreviewsNumber" id="358"/>
</connections>
</popUpButton>
+ <button id="Ndp-Xh-ohY">
+ <rect key="frame" x="125" y="63" width="340" height="18"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <buttonCell key="cell" type="check" title="Clear logs older than 30 days" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="lgn-RF-k0d">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ </buttonCell>
+ <connections>
+ <binding destination="61" name="value" keyPath="values.HBClearOldLogs" id="98r-xV-IVB"/>
+ </connections>
+ </button>
</subviews>
- <point key="canvasLocation" x="-50" y="-68"/>
+ <point key="canvasLocation" x="-82" y="-62"/>
</customView>
<customObject id="410" userLabel="Updater" customClass="SUUpdater"/>
</objects>
diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m
index 42c18435a..1a78e0815 100644
--- a/macosx/HBAppDelegate.m
+++ b/macosx/HBAppDelegate.m
@@ -89,26 +89,6 @@
// Get the number of HandBrake instances currently running
NSUInteger instances = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]].count;
- // If we are a single instance it is safe to clean up the previews if there are any
- // left over. This is a bit of a kludge but will prevent a build up of old instance
- // live preview cruft. No danger of removing an active preview directory since they
- // are created later in HBPreviewController if they don't exist at the moment a live
- // preview encode is initiated.
- if (instances == 1)
- {
- NSString *previewDirectory = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Previews"];
- NSError *error = nil;
- NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:previewDirectory error:&error];
- for (NSString *file in files)
- {
- BOOL result = [[NSFileManager defaultManager] removeItemAtPath:[previewDirectory stringByAppendingPathComponent:file] error:&error];
- if (result == NO && error)
- {
- [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", file.UTF8String];
- }
- }
- }
-
[self showMainWindow:self];
// Now we re-check the queue array to see if there are
@@ -199,9 +179,22 @@
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"])
[self showQueueWindow:nil];
- // Remove encodes logs older than a month
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
- [self cleanEncodeLogs];
+ // Remove encodes logs older than a month
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBClearOldLogs"])
+ {
+ [self cleanEncodeLogs];
+ }
+
+ // If we are a single instance it is safe to clean up the previews if there are any
+ // left over. This is a bit of a kludge but will prevent a build up of old instance
+ // live preview cruft. No danger of removing an active preview directory since they
+ // are created later in HBPreviewController if they don't exist at the moment a live
+ // preview encode is initiated.
+ if (instances == 1)
+ {
+ [self cleanPreviews];
+ }
});
}
@@ -300,27 +293,55 @@
{
NSURL *directoryUrl = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"EncodeLogs"];
- NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:directoryUrl
- includingPropertiesForKeys:nil
- options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
- NSDirectoryEnumerationSkipsHiddenFiles |
- NSDirectoryEnumerationSkipsPackageDescendants
- error:NULL];
+ if (directoryUrl)
+ {
+ NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:directoryUrl
+ includingPropertiesForKeys:nil
+ options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
+ NSDirectoryEnumerationSkipsHiddenFiles |
+ NSDirectoryEnumerationSkipsPackageDescendants
+ error:NULL];
- NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: -(60 * 60 * 24 * 30)];
- NSFileManager *manager = [[NSFileManager alloc] init];
+ NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: -(60 * 60 * 24 * 30)];
+ NSFileManager *manager = [[NSFileManager alloc] init];
- for (NSURL *fileURL in contents)
- {
- NSDate *creationDate = nil;
- [fileURL getResourceValue:&creationDate forKey:NSURLCreationDateKey error:NULL];
- if ([creationDate isLessThan:limit])
+ for (NSURL *fileURL in contents)
{
- [manager removeItemAtURL:fileURL error:NULL];
+ NSDate *creationDate = nil;
+ [fileURL getResourceValue:&creationDate forKey:NSURLCreationDateKey error:NULL];
+ if ([creationDate isLessThan:limit])
+ {
+ [manager removeItemAtURL:fileURL error:NULL];
+ }
}
+ [manager release];
}
+}
- [manager release];
+- (void)cleanPreviews
+{
+ NSURL *previewDirectory = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"Previews"];
+
+ if (previewDirectory)
+ {
+ NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:previewDirectory
+ includingPropertiesForKeys:nil
+ options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
+ NSDirectoryEnumerationSkipsPackageDescendants
+ error:NULL];
+
+ NSFileManager *manager = [[NSFileManager alloc] init];
+ for (NSURL *url in contents)
+ {
+ NSError *error = nil;
+ BOOL result = [manager removeItemAtURL:url error:&error];
+ if (result == NO && error)
+ {
+ [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", url.lastPathComponent.UTF8String];
+ }
+ }
+ [manager release];
+ }
}
#pragma mark - Menu actions
diff --git a/macosx/HBJobOutputFileWriter.m b/macosx/HBJobOutputFileWriter.m
index 2ae3c161d..fa84350ec 100644
--- a/macosx/HBJobOutputFileWriter.m
+++ b/macosx/HBJobOutputFileWriter.m
@@ -37,15 +37,8 @@
else
{
// if we are putting it in the default ~/Libraries/Application Support/HandBrake/EncodeLogs logs directory
- NSString *encodeLogDirectory = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"EncodeLogs"];
- if( ![[NSFileManager defaultManager] fileExistsAtPath:encodeLogDirectory] )
- {
- [[NSFileManager defaultManager] createDirectoryAtPath:encodeLogDirectory
- withIntermediateDirectories:NO
- attributes:nil
- error:nil];
- }
- outputURL = [[NSURL fileURLWithPath:encodeLogDirectory] URLByAppendingPathComponent:outputDateFileName];
+ NSURL *encodeLogDirectory = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"EncodeLogs"];
+ outputURL = [encodeLogDirectory URLByAppendingPathComponent:outputDateFileName];
}
self = [super initWithFileURL:outputURL];
diff --git a/macosx/HBOutputFileWriter.m b/macosx/HBOutputFileWriter.m
index f01293f12..919ce04dc 100644
--- a/macosx/HBOutputFileWriter.m
+++ b/macosx/HBOutputFileWriter.m
@@ -17,6 +17,12 @@
self = [super init];
if (self)
{
+
+ [[NSFileManager defaultManager] createDirectoryAtPath:url.URLByDeletingLastPathComponent.path
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:NULL];
+
_url = [url copy];
f = fopen(url.fileSystemRepresentation, "w");
f = freopen(NULL, "a", f);
diff --git a/macosx/HBOutputPanelController.m b/macosx/HBOutputPanelController.m
index 53a27c703..909fbe736 100644
--- a/macosx/HBOutputPanelController.m
+++ b/macosx/HBOutputPanelController.m
@@ -49,17 +49,9 @@
(void)[self window];
// Additionally, redirect the output to a file on the disk.
- NSFileManager *fileManager = [NSFileManager defaultManager];
- NSString *outputLogFile = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"HandBrake-activitylog.txt"];
+ NSURL *outputLogFile = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"HandBrake-activitylog.txt"];
- // We check for an existing output log file here
- if ([fileManager fileExistsAtPath:outputLogFile] == NO)
- {
- // if not, then we create a new blank one
- [fileManager createFileAtPath:outputLogFile contents:nil attributes:nil];
- }
-
- _outputFile = [[HBOutputFileWriter alloc] initWithFileURL:[NSURL fileURLWithPath:outputLogFile]];
+ _outputFile = [[HBOutputFileWriter alloc] initWithFileURL:outputLogFile];
[[HBOutputRedirect stderrRedirect] addListener:_outputFile];
[[HBOutputRedirect stdoutRedirect] addListener:_outputFile];
@@ -166,9 +158,7 @@
- (IBAction)openActivityLogFile:(id)sender
{
/* Opens the activity window log file in the users default text editor */
- NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource:[NSString stringWithFormat: @"%@%@%@", @"tell application \"Finder\" to open (POSIX file \"", self.outputFile.url.path, @"\")"]];
- [myScript executeAndReturnError: nil];
- [myScript release];
+ [[NSWorkspace sharedWorkspace] openURL:self.outputFile.url];
}
/**
@@ -177,18 +167,15 @@
- (IBAction)openEncodeLogDirectory:(id)sender
{
/* Opens the activity window log file in the users default text editor */
- NSString *encodeLogDirectory = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"EncodeLogs"];
- if( ![[NSFileManager defaultManager] fileExistsAtPath:encodeLogDirectory] )
+ NSURL *encodeLogDirectory = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"EncodeLogs"];
+ if( ![[NSFileManager defaultManager] fileExistsAtPath:encodeLogDirectory.path] )
{
- [[NSFileManager defaultManager] createDirectoryAtPath:encodeLogDirectory
+ [[NSFileManager defaultManager] createDirectoryAtPath:encodeLogDirectory.path
withIntermediateDirectories:NO
attributes:nil
error:nil];
}
-
- NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource: [NSString stringWithFormat: @"%@%@%@", @"tell application \"Finder\" to open (POSIX file \"", encodeLogDirectory, @"\")"]];
- [myScript executeAndReturnError: nil];
- [myScript release];
+ [[NSWorkspace sharedWorkspace] openURL:encodeLogDirectory];
}
- (IBAction)clearActivityLogFile:(id)sender
diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m
index 22d9fcab8..8bbb58015 100644
--- a/macosx/HBPreferencesController.m
+++ b/macosx/HBPreferencesController.m
@@ -70,6 +70,7 @@
@"AlertWhenDone": @"Alert Window",
@"AlertWhenDoneSound": @"YES",
@"LoggingLevel": @"1",
+ @"HBClearOldLogs": @YES,
@"EncodeLogLocation": @"NO",
@"MinTitleScanSeconds": @"10",
@"PreviewsNumber": @"10",
diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m
index a7efb4d2f..46352aa55 100644
--- a/macosx/HBPreviewGenerator.m
+++ b/macosx/HBPreviewGenerator.m
@@ -100,19 +100,17 @@
+ (NSURL *) generateFileURLForType:(NSString *) type
{
- NSString *previewDirectory = [NSString stringWithFormat:@"%@/Previews/%d", [HBUtilities appSupportPath], getpid()];
+ NSURL *previewDirectory = [[HBUtilities appSupportURL] URLByAppendingPathComponent:[NSString stringWithFormat:@"/Previews/%d", getpid()] isDirectory:YES];
- if (![[NSFileManager defaultManager] fileExistsAtPath:previewDirectory])
- {
- if (![[NSFileManager defaultManager] createDirectoryAtPath:previewDirectory
+ if (![[NSFileManager defaultManager] createDirectoryAtPath:previewDirectory.path
withIntermediateDirectories:YES
attributes:nil
error:nil])
- return nil;
+ {
+ return nil;
}
- return [[NSURL fileURLWithPath:previewDirectory]
- URLByAppendingPathComponent:[NSString stringWithFormat:@"preview_temp.%@", type]];
+ return [previewDirectory URLByAppendingPathComponent:[NSString stringWithFormat:@"preview_temp.%@", type]];
}
/**
@@ -149,10 +147,7 @@
}
// See if there is an existing preview file, if so, delete it.
- if (![[NSFileManager defaultManager] fileExistsAtPath:destURL.path])
- {
- [[NSFileManager defaultManager] removeItemAtPath:destURL.path error:NULL];
- }
+ [[NSFileManager defaultManager] removeItemAtURL:destURL error:NULL];
HBJob *job = [[self.job copy] autorelease];
job.title = self.job.title;
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index b4b4c0e76..0963a453e 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -234,7 +234,7 @@
- (void)loadQueueFile
{
- NSURL *queueURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Queue.hbqueue"]];
+ NSURL *queueURL = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"Queue.hbqueue"];
_jobs = [[HBDistributedArray alloc] initWithURL:queueURL];
[self reloadQueue];
diff --git a/macosx/HBUtilities.h b/macosx/HBUtilities.h
index dac8e5085..eed1cafcd 100644
--- a/macosx/HBUtilities.h
+++ b/macosx/HBUtilities.h
@@ -14,11 +14,6 @@
+ (NSString *)handBrakeVersion;
/**
- * Returns the path of the current <user>/Library/Application Support/HandBrake folder.
- */
-+ (NSString *)appSupportPath;
-
-/**
* Returns the url of the current <user>/Library/Application Support/HandBrake folder.
*/
+ (NSURL *)appSupportURL;
diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m
index 6a61e1ab1..3e4fdb272 100644
--- a/macosx/HBUtilities.m
+++ b/macosx/HBUtilities.m
@@ -17,19 +17,6 @@
infoDictionary[@"CFBundleVersion"]];
}
-+ (NSString *)appSupportPath
-{
- NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
- NSUserDomainMask,
- YES) firstObject] stringByAppendingPathComponent:@"HandBrake"];
-
- NSFileManager *fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:appSupportPath])
- [fileManager createDirectoryAtPath:appSupportPath withIntermediateDirectories:YES attributes:nil error:NULL];
-
- return appSupportPath;
-}
-
+ (NSURL *)appSupportURL
{
NSFileManager *fileManager = [NSFileManager defaultManager];