]> granicus.if.org Git - handbrake/commitdiff
MacGui: refactor the stderr/stdout redirect code to be more modular.
authorritsuka <damiog@gmail.com>
Fri, 20 Feb 2015 07:59:38 +0000 (07:59 +0000)
committerritsuka <damiog@gmail.com>
Fri, 20 Feb 2015 07:59:38 +0000 (07:59 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6927 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBAppDelegate.m
macosx/HBJobOutputFileWriter.h [new file with mode: 0644]
macosx/HBJobOutputFileWriter.m [new file with mode: 0644]
macosx/HBOutputFileWriter.h [new file with mode: 0644]
macosx/HBOutputFileWriter.m [new file with mode: 0644]
macosx/HBOutputPanelController.h
macosx/HBOutputPanelController.m
macosx/HBQueueController.h
macosx/HBQueueController.m
macosx/HBUtilities.h
macosx/HBUtilities.m

index c28164a9e2c7998bee68219e6b1d49ec3b278916..2d8259b226467705ae6936133bcab3bc49a9ef4a 100644 (file)
@@ -58,7 +58,6 @@
         _presetsManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
 
         _queueController = [[HBQueueController alloc] init];
-        _queueController.outputPanel = _outputPanel;
         _queueController.delegate = self;
         _mainController = [[HBController alloc] initWithQueue:_queueController presetsManager:_presetsManager];
 
diff --git a/macosx/HBJobOutputFileWriter.h b/macosx/HBJobOutputFileWriter.h
new file mode 100644 (file)
index 0000000..3cf2e7f
--- /dev/null
@@ -0,0 +1,19 @@
+/*  HBJobOutputFileWriter.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBOutputFileWriter.h"
+
+@class HBJob;
+
+/**
+ * Redirects the output to a new file based on the job destination
+ * and the current logging preference.
+ */
+@interface HBJobOutputFileWriter : HBOutputFileWriter
+
+- (instancetype)initWithJob:(HBJob *)job;
+
+@end
diff --git a/macosx/HBJobOutputFileWriter.m b/macosx/HBJobOutputFileWriter.m
new file mode 100644 (file)
index 0000000..2ae3c16
--- /dev/null
@@ -0,0 +1,64 @@
+/*  HBJobOutputFileWriter.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBJobOutputFileWriter.h"
+#import "HBJob.h"
+#import "HBUtilities.h"
+
+@implementation HBJobOutputFileWriter
+
+- (instancetype)initWithJob:(HBJob *)job
+{
+    NSURL *outputURL= job.destURL;
+
+    // Establish the log file location to write to.
+    // We need to get the current time in YY-MM-DD HH-MM-SS format to put at the beginning of the name of the log file
+    time_t _now = time(NULL);
+    struct tm *now = localtime(&_now);
+    NSString *dateForLogTitle = [NSString stringWithFormat:@"%02d-%02d-%02d %02d-%02d-%02d",
+                                 now->tm_year + 1900,
+                                 now->tm_mon + 1,
+                                 now->tm_mday,now->tm_hour,
+                                 now->tm_min, now->tm_sec];
+
+    // Assemble the new log file name as YY-MM-DD HH-MM-SS mymoviename.txt
+    NSString *outputDateFileName = [NSString stringWithFormat:@"%@ %@.txt",
+                                    outputURL.lastPathComponent.stringByDeletingPathExtension,
+                                    dateForLogTitle];
+
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EncodeLogLocation"])
+    {
+        // if we are putting it in the same directory with the movie
+        outputURL = [outputURL.URLByDeletingLastPathComponent URLByAppendingPathComponent:outputDateFileName];
+    }
+    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];
+    }
+
+    self = [super initWithFileURL:outputURL];
+    if (self)
+    {
+        // Additional header info.
+        [self write:job.destURL.lastPathComponent];
+        [self write:@"\nPreset: "];
+        [self write:job.presetName];
+        [self write:@"\n"];
+    }
+
+    return self;
+}
+
+@end
diff --git a/macosx/HBOutputFileWriter.h b/macosx/HBOutputFileWriter.h
new file mode 100644 (file)
index 0000000..3538cc7
--- /dev/null
@@ -0,0 +1,23 @@
+/*  HBOutputFileWriter.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Foundation/Foundation.h>
+#import "HBOutputRedirect.h"
+
+/**
+ * This class is used to listen to HBOutputRedirect
+ * and write the output to a file.
+ */
+@interface HBOutputFileWriter : NSObject <HBOutputRedirectListening>
+
+- (instancetype)initWithFileURL:(NSURL *)url;
+
+- (void)write:(NSString *)text;
+- (void)clear;
+
+@property (nonatomic, readonly) NSURL *url;
+
+@end
diff --git a/macosx/HBOutputFileWriter.m b/macosx/HBOutputFileWriter.m
new file mode 100644 (file)
index 0000000..f01293f
--- /dev/null
@@ -0,0 +1,69 @@
+/*  HBOutputFileWriter.m $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBOutputFileWriter.h"
+#import "HBUtilities.h"
+
+@implementation HBOutputFileWriter
+{
+    FILE *f;
+}
+
+- (instancetype)initWithFileURL:(NSURL *)url;
+{
+    self = [super init];
+    if (self)
+    {
+        _url = [url copy];
+        f = fopen(url.fileSystemRepresentation, "w");
+        f = freopen(NULL, "a", f);
+
+        [self writeHeaderForReason:@"Session"];
+    }
+
+    return self;
+}
+
+- (void)dealloc
+{
+    fclose(f);
+    [_url release];
+    [super dealloc];
+}
+
+- (void)writeHeaderForReason:(NSString *)reason
+{
+    [self write:[NSString stringWithFormat:@"HandBrake Activity Log for %@: %@\n%@\n",
+                 reason,
+                 [[NSDate date] descriptionWithCalendarFormat:nil timeZone:nil locale:nil],
+                 [HBUtilities handBrakeVersion]]];
+}
+
+- (void)write:(NSString *)text
+{
+    fprintf(f, "%s", text.UTF8String);
+    fflush(f);
+}
+
+- (void)stdoutRedirect:(NSString *)text
+{
+    [self write:text];
+}
+
+- (void)stderrRedirect:(NSString *)text
+{
+    [self write:text];
+}
+
+- (void)clear
+{
+    f = freopen(NULL, "w", f);
+    f = freopen(NULL, "a", f);
+
+    [self writeHeaderForReason:@"Session (Cleared)"];
+}
+
+@end
index 38a9f867c7b4a376fed16501ab6090ccfd734638..32907b02b1b72abcef83a2c7bc19096241392d89 100644 (file)
@@ -18,7 +18,5 @@
 - (IBAction)openActivityLogFile:(id)sender;
 - (IBAction)openEncodeLogDirectory:(id)sender;
 - (IBAction)clearActivityLogFile:(id)sender;
-- (void)startEncodeLog:(NSURL *)logURL;
-- (void)endEncodeLog;
 
 @end
index c275c3970a6b0293b340e65346ed4e693d6a6baf..53a27c703eda7f9273e37aa6d22469f2d535ad99 100644 (file)
@@ -7,19 +7,14 @@
 
 #import "HBOutputPanelController.h"
 #import "HBOutputRedirect.h"
+#import "HBOutputFileWriter.h"
 #import "HBUtilities.h"
 
 /// Maximum amount of characters that can be shown in the view.
-// Original value used by cleaner
-//#define TextStorageUpperSizeLimit 20000
-// lets use this higher value for now for better gui debugging
 #define TextStorageUpperSizeLimit 125000
 
 /// When old output is removed, this is the amount of characters that will be
 /// left in outputTextStorage.
-// Original value used by cleaner
-//#define TextStorageLowerSizeLimit 15000
-// lets use this higher value for now for better gui debugging
 #define TextStorageLowerSizeLimit 120000
 
 @interface HBOutputPanelController () <HBOutputRedirectListening>
 }
 
 /// Path to log text file.
-@property (nonatomic, copy) NSString *outputLogFile;
-
-/// Path to individual log text file.
-@property (nonatomic, copy) NSString *outputLogFileForEncode;
-
-/// Whether we are writing an addition log file for the current encode or not.
-@property (nonatomic) BOOL encodeLogOn;
+@property (nonatomic, copy, readonly) HBOutputFileWriter *outputFile;
 
 @end
 
@@ -47,7 +36,7 @@
 /**
  * Initializes the object, creates outputTextStorage and starts redirection of stderr.
  */
-- (id)init
+- (instancetype)init
 {
     if( (self = [super initWithWindowNibName:@"OutputPanel"]) )
     {
          *
          * If/when we switch to using bindings, this can probably go away.
          */
-        [self window];
+        (void)[self window];
 
-        // Use the inline search bar if available.
-        if ([textView respondsToSelector:@selector(setUsesFindBar:)])
+        // Additionally, redirect the output to a file on the disk.
+        NSFileManager *fileManager = [NSFileManager defaultManager];
+        NSString *outputLogFile = [[HBUtilities appSupportPath] stringByAppendingPathComponent:@"HandBrake-activitylog.txt"];
+
+        // We check for an existing output log file here
+        if ([fileManager fileExistsAtPath:outputLogFile] == NO)
         {
-            [textView setUsesFindBar:YES];
+            // if not, then we create a new blank one
+            [fileManager createFileAtPath:outputLogFile contents:nil attributes:nil];
         }
 
-        /* We initialize the outputTextStorage object for the activity window */
-        outputTextStorage = [[NSTextStorage alloc] init];
+        _outputFile = [[HBOutputFileWriter alloc] initWithFileURL:[NSURL fileURLWithPath:outputLogFile]];
+        [[HBOutputRedirect stderrRedirect] addListener:_outputFile];
+        [[HBOutputRedirect stdoutRedirect] addListener:_outputFile];
 
-        /* We declare the default NSFileManager into fileManager */
-        NSFileManager * fileManager = [NSFileManager defaultManager];
-        /* Establish the log file location to write to */
-        /* We are initially using a .txt file as opposed to a .log file since it will open by
-         * default with the users text editor instead of the .log default Console.app, should
-         * create less confusion for less experienced users when we ask them to paste the log for support
-         */
-        _outputLogFile = [[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"HandBrake-activitylog.txt"] retain];
+        // We initialize the outputTextStorage object for the activity window
+        outputTextStorage = [[NSTextStorage alloc] init];
 
-        /* We check for an existing output log file here */
-        if ([fileManager fileExistsAtPath:_outputLogFile] == NO)
+        // Use the inline search bar if available.
+        if ([textView respondsToSelector:@selector(setUsesFindBar:)])
         {
-            /* if not, then we create a new blank one */
-            [fileManager createFileAtPath:_outputLogFile contents:nil attributes:nil];
+            [textView setUsesFindBar:YES];
         }
-        /* We overwrite the existing output log with the date for starters the output log to start fresh with the new session */
-        /* Use the current date and time for the new output log header */
-        NSString *startOutputLogString = [self logHeaderForReason:@"Session (Cleared)"];
-        [startOutputLogString writeToFile:_outputLogFile atomically:YES encoding:NSUTF8StringEncoding error:NULL];
-
-        [[HBOutputRedirect stderrRedirect] addListener:self];
-        [[HBOutputRedirect stdoutRedirect] addListener:self];
 
         [[textView layoutManager] replaceTextStorage:outputTextStorage];
         [[textView enclosingScrollView] setLineScroll:10];
         [[textView enclosingScrollView] setPageScroll:20];
-        
-        _encodeLogOn = NO;
+
+        // Add ourself as stderr/stdout listener
+        [[HBOutputRedirect stderrRedirect] addListener:self];
+        [[HBOutputRedirect stdoutRedirect] addListener:self];
     }
     return self;
 }
     [[HBOutputRedirect stderrRedirect] removeListener:self];
     [[HBOutputRedirect stdoutRedirect] removeListener:self];
     [outputTextStorage release];
+    [_outputFile release];
+
     [super dealloc];
 }
 
     }
 }
 
-- (NSString *)logHeaderForReason:(NSString *)reason
-{
-    return [NSString stringWithFormat:@"HandBrake Activity Log for %@: %@\n%@",
-            reason,
-            [[NSDate date] descriptionWithCalendarFormat:nil timeZone:nil locale:nil],
-            [self handBrakeVersion]];
-}
-
-- (NSString *)handBrakeVersion
-{
-    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
-    return [NSString stringWithFormat:@"Handbrake Version: %@ (%@)",
-            infoDictionary[@"CFBundleShortVersionString"],
-            infoDictionary[@"CFBundleVersion"]];
-}
-
-- (void)startEncodeLog:(NSURL *)logURL
-{
-    self.encodeLogOn = YES;
-    NSString *outputFileForEncode = logURL.path ;
-    /* Since the destination path matches the extension of the output file, replace the
-     * output movie extension and replace it with ".txt"
-     */
-    NSFileManager * fileManager = [NSFileManager defaultManager];
-    /* Establish the log file location to write to */
-    /* We are initially using a .txt file as opposed to a .log file since it will open by
-     * default with the users text editor instead of the .log default Console.app, should
-     * create less confusion for less experienced users when we ask them to paste the log for support
-     */
-    /* We need to get the current time in YY-MM-DD HH-MM-SS format to put at the beginning of the name of the log file */
-    time_t _now = time( NULL );
-    struct tm * now  = localtime( &_now );
-    NSString *dateForLogTitle = [NSString stringWithFormat:@"%02d-%02d-%02d %02d-%02d-%02d",now->tm_year + 1900, now->tm_mon + 1, now->tm_mday,now->tm_hour, now->tm_min, now->tm_sec]; 
-    
-    /* Assemble the new log file name as YY-MM-DD HH-MM-SS mymoviename.txt */
-    NSString *outputDateFileName = [NSString stringWithFormat:@"%@ %@.txt",[[outputFileForEncode lastPathComponent] stringByDeletingPathExtension],dateForLogTitle];
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EncodeLogLocation"]) // if we are putting it in the same directory with the movie
-    {
-        self.outputLogFileForEncode = [NSString stringWithFormat:@"%@/%@",[outputFileForEncode stringByDeletingLastPathComponent], outputDateFileName];
-    }
-    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];
-        }
-        self.outputLogFileForEncode = [NSString stringWithFormat:@"%@/%@",encodeLogDirectory,outputDateFileName];
-    }
-    [fileManager createFileAtPath:self.outputLogFileForEncode contents:nil attributes:nil];
-    
-    /* Similar to the regular activity log, we print a header containing the date and time of the encode as well as what directory it was encoded to */
-    NSString *startOutputLogString = [self logHeaderForReason:outputFileForEncode];
-    [startOutputLogString writeToFile:self.outputLogFileForEncode atomically:YES encoding:NSUTF8StringEncoding error:NULL];
-}
-
-- (void) endEncodeLog
-{
-    self.encodeLogOn = NO;
-}
-
 /**
  * Displays text received from HBOutputRedirect in the text view
  * and write it to the log files.
  */
 - (void)stderrRedirect:(NSString *)text
 {
-       
     NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:text];
        /* Actually write the libhb output to the text view (outputTextStorage) */
     [outputTextStorage appendAttributedString:attributedString];
     
        /* remove text from outputTextStorage as defined by TextStorageUpperSizeLimit and TextStorageLowerSizeLimit */
     if (outputTextStorage.length > TextStorageUpperSizeLimit)
+    {
                [outputTextStorage deleteCharactersInRange:NSMakeRange(0, [outputTextStorage length] - TextStorageLowerSizeLimit)];
+    }
 
     if (self.window.isVisible)
     {
         [textView scrollToEndOfDocument:self];
     }
-
-    FILE *f = fopen(_outputLogFile.fileSystemRepresentation, "a");
-    fprintf(f, "%s", text.UTF8String);
-    fclose(f);
-
-    if (_encodeLogOn == YES && _outputLogFileForEncode != nil)
-    {
-        FILE *e = fopen(_outputLogFileForEncode.fileSystemRepresentation, "a");
-        fprintf(e, "%s", text.UTF8String);
-        fclose(e);
-    }
 }
 - (void)stdoutRedirect:(NSString *)text { [self stderrRedirect:text]; }
 
     /* We want to rewrite the app version info to the top of the activity window so it is always present */
     time_t _now = time( NULL );
     struct tm * now  = localtime( &_now );
-    fprintf(stderr, "[%02d:%02d:%02d] macgui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, [[self handBrakeVersion] UTF8String]);
+    fprintf(stderr, "[%02d:%02d:%02d] macgui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, [[HBUtilities handBrakeVersion] UTF8String]);
 }
 
 /**
        NSPasteboard *pboard = [NSPasteboard generalPasteboard];
        [pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
        [pboard setString:[outputTextStorage string] forType:NSStringPboardType];
-    
 }
 
 /**
 - (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 \"", _outputLogFile, @"\")"]];
+    NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource:[NSString stringWithFormat: @"%@%@%@", @"tell application \"Finder\" to open (POSIX file \"", self.outputFile.url.path, @"\")"]];
     [myScript executeAndReturnError: nil];
     [myScript release];
 }
 
 - (IBAction)clearActivityLogFile:(id)sender
 {
-    /* We overwrite the existing output log with the new date and time header */
-    /* Use the current date and time for the new output log header */
-    NSString *startOutputLogString = [self logHeaderForReason:@"Session Starting"];
-    [startOutputLogString writeToFile:_outputLogFile atomically:NO encoding:NSUTF8StringEncoding error:NULL];
-
-    /* We want to rewrite the app version info to the top of the activity window so it is always present */
-    NSString *versionStringFull = [self handBrakeVersion];
-    [versionStringFull writeToFile:_outputLogFile atomically:NO encoding:NSUTF8StringEncoding error:NULL];
+    [self.outputFile clear];
 }
 
 - (void)windowWillClose:(NSNotification *)aNotification
     [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"OutputPanelIsOpen"];
 }
 
-
 @end
index 0a48dff66358ec432e92fc763ae8dc1a33b4ba28..0e00267b9401176b057d30eb0bc343e13d68dde7 100644 (file)
@@ -20,7 +20,6 @@
 
 @property (nonatomic, assign) HBController *controller;
 @property (nonatomic, assign) HBAppDelegate *delegate;
-@property (nonatomic, assign) HBOutputPanelController *outputPanel;
 
 @property (nonatomic, readonly) NSUInteger count;
 @property (nonatomic, readonly) NSUInteger pendingItemsCount;
index fb7ff6385b110258caf38d27bcf750751b8c0994..aab0b05300c8554cf2e30949e52b208b550564d6 100644 (file)
@@ -10,7 +10,6 @@
 #import "HBCore.h"
 #import "HBController.h"
 #import "HBAppDelegate.h"
-#import "HBOutputPanelController.h"
 
 #import "HBQueueOutlineView.h"
 #import "HBUtilities.h"
@@ -22,6 +21,9 @@
 
 #import "HBDockTile.h"
 
+#import "HBOutputRedirect.h"
+#import "HBJobOutputFileWriter.h"
+
 // Pasteboard type for or drag operations
 #define DragDropSimplePboardType    @"HBQueueCustomOutlineViewPboardType"
 
@@ -43,6 +45,7 @@
 
 @property (nonatomic, readonly) HBDistributedArray *jobs;
 @property (nonatomic, retain)   HBJob *currentJob;
+@property (nonatomic, retain)   HBJobOutputFileWriter *currentLog;
 
 @property (nonatomic, readwrite) BOOL stop;
 
 {
     if (self = [super initWithWindowNibName:@"Queue"])
     {
-        // NSWindowController likes to lazily load its window nib. Since this
-        // controller tries to touch the outlets before accessing the window, we
-        // need to force it to load immadiately by invoking its accessor.
-        //
-        // If/when we switch to using bindings, this can probably go away.
-        [self window];
-
         _descriptions = [[NSMutableDictionary alloc] init];
 
         // Workaround to avoid a bug in Snow Leopard
         self.currentJob.state = HBJobStateWorking;
 
         // Tell HB to output a new activity log file for this encode
-        [self.outputPanel startEncodeLog:self.currentJob.destURL];
+        self.currentLog = [[[HBJobOutputFileWriter alloc] initWithJob:self.currentJob] autorelease];
+        [[HBOutputRedirect stderrRedirect] addListener:self.currentLog];
+        [[HBOutputRedirect stdoutRedirect] addListener:self.currentLog];
 
         // now we can go ahead and scan the new pending queue item
         [self performScan:self.currentJob.fileURL titleIdx:self.currentJob.titleIdx];
 {
     // Since we are done with this encode, tell output to stop writing to the
     // individual encode log.
-    [self.outputPanel endEncodeLog];
+    [[HBOutputRedirect stderrRedirect] removeListener:self.currentLog];
+    [[HBOutputRedirect stdoutRedirect] removeListener:self.currentLog];
+    self.currentLog = nil;
 
     // Check to see if the encode state has not been cancelled
     // to determine if we should check for encode done notifications.
index 754e872ab12556d4862c3b77afa0e24d32442783..2e073d17a7c8cb5f1a23931e70bcf64ef855b381 100644 (file)
@@ -8,6 +8,11 @@
 
 @interface HBUtilities : NSObject
 
+/**
+ *  Returns a formatted string that contains the application version.
+ */
++ (NSString *)handBrakeVersion;
+
 /**
  *  Returns the path of the current <user>/Library/Application Support/HandBrake folder.
  */
index eec539c2bef7b68c203ab78f9244006b5a84ae06..c661b2a261706d781ed78d32fd296a612264f9bb 100644 (file)
@@ -9,6 +9,14 @@
 
 @implementation HBUtilities
 
++ (NSString *)handBrakeVersion
+{
+    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
+    return [NSString stringWithFormat:@"Handbrake Version: %@ (%@)",
+            infoDictionary[@"CFBundleShortVersionString"],
+            infoDictionary[@"CFBundleVersion"]];
+}
+
 + (NSString *)appSupportPath
 {
     NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,