]> granicus.if.org Git - handbrake/commitdiff
MacGui: Last source directory used is now remembered and used the next time instead...
authordynaflash <dynaflashtech@gmail.com>
Thu, 5 Apr 2007 17:28:16 +0000 (17:28 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Thu, 5 Apr 2007 17:28:16 +0000 (17:28 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@481 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.mm
macosx/PrefsController.m
macosx/ScanController.mm

index e4314c4e83fd1a977172e30ffdfee8663aaa7e1c..7ebcd9a91589984d807d6231781805f5aa8d0ece 100644 (file)
@@ -939,7 +939,7 @@ static int FormatSettings[3][4] =
             [fDstFile2Field stringValue]] );
         return;
     }
-       /* We get the destination directory from the destingation field here */
+       /* We get the destination directory from the destination field here */
        NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent];
        /* We check for a valid destination here */
        if ([[NSFileManager defaultManager] fileExistsAtPath:destinationDirectory] == 0) 
index 8f5dd61d86e6fe74871d2a5299938b3b6f710864..9ce02435a4ee4f241b7d301e4b7a0f8b9552ec9c 100644 (file)
        NSString *defDestDirectory =  @"~/Desktop";
        defDestDirectory = [defDestDirectory stringByExpandingTildeInPath];
        appDefaults = [NSDictionary dictionaryWithObject:defDestDirectory forKey:@"LastDestinationDirectory"];
+       
+       NSString *defSrcDirectory =  @"~/Desktop";
+       defSrcDirectory = [defSrcDirectory stringByExpandingTildeInPath];
+       appDefaults = [NSDictionary dictionaryWithObject:defSrcDirectory forKey:@"LastSourceDirectory"];
+       
        appDefaults = [NSDictionary dictionaryWithObject:@"NO"
                    forKey:@"DefaultAutoNaming"];
        appDefaults = [NSDictionary dictionaryWithObject:@"NO"
index 9ce44f8fe6a3b90fbfcf7b058959ccbe10f0abc4..cad783377c8d5e818ded674359435720fcd37b81 100644 (file)
     [panel setAllowsMultipleSelection: NO];
     [panel setCanChooseFiles: YES];
     [panel setCanChooseDirectories: YES ];
-
-    [panel beginSheetForDirectory: nil file: nil types: nil
+    NSString * sourceDirectory;
+       if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastSourceDirectory"])
+       {
+       sourceDirectory = [[NSUserDefaults standardUserDefaults] stringForKey:@"LastSourceDirectory"];
+       }
+       else
+       {
+       sourceDirectory = @"~/Desktop";
+       sourceDirectory = [sourceDirectory stringByExpandingTildeInPath];
+       }
+    [panel beginSheetForDirectory: sourceDirectory file: nil types: nil
         modalForWindow: [NSApp mainWindow] modalDelegate: self
         didEndSelector: @selector( BrowseDone:returnCode:contextInfo: )
         contextInfo: nil];
 
     if( [fMatrix selectedRow] )
     {
+       /* we set the last source directory in the prefs here */
+       NSString *sourceDirectory = [[fFolderField stringValue] stringByDeletingLastPathComponent];
+       [[NSUserDefaults standardUserDefaults] setObject:sourceDirectory forKey:@"LastSourceDirectory"];
        hb_scan( fHandle, [[fFolderField stringValue] UTF8String], 0 );
     }
     else