diff options
author | ritsuka <[email protected]> | 2015-02-21 07:28:48 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-02-21 07:28:48 +0000 |
commit | 53508d57a481fa1e67ac66541581f925dda7fd6e (patch) | |
tree | 0c12901fc8489ede0a4a24792225681e1d7cb40d /macosx/HBPreviewGenerator.m | |
parent | 34c5f777ed3d5d15f9b805bfbda600c4ead7977c (diff) |
MacGui: add a preference to toggle the log cleanup. Use NSURL directly where possible.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6934 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPreviewGenerator.m')
-rw-r--r-- | macosx/HBPreviewGenerator.m | 17 |
1 files changed, 6 insertions, 11 deletions
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; |