X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/c7646de5dd9ea11811896be9505aee0564431ef8..5096b69ba044666162286ecee6689fdc1ecff6b3:/ITLoginItem.m diff --git a/ITLoginItem.m b/ITLoginItem.m index f2f9e19..05a16b0 100755 --- a/ITLoginItem.m +++ b/ITLoginItem.m @@ -22,25 +22,23 @@ void ITSetApplicationLaunchOnLogin(NSString *path, BOOL flag) ITDebugLog(@"Set if \"%@\" launches at login to %i.", path, flag); [df synchronize]; loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy]; - loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"]; + loginarray = [[loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"] mutableCopy]; if (flag) { - FSRef fileRef; + /*FSRef fileRef; AliasHandle alias; NSData *aliasData; FSPathMakeRef([path UTF8String], &fileRef, NULL); FSNewAlias(NULL, &fileRef, &alias); - aliasData = [NSData dataWithBytes:&alias length:GetHandleSize((Handle)alias)]; + aliasData = [NSData dataWithBytes:&alias length:GetHandleSize((Handle)alias)];*/ if (!loginarray) { //If there is no loginarray of autolaunch items, create one loginarray = [[[NSMutableArray alloc] init] autorelease]; - [loginwindow setObject:loginarray forKey:@"AutoLaunchedApplicationDictionary"]; } - NSDictionary *itemDict = [NSDictionary dictionaryWithObjectsAndKeys: - [[NSBundle mainBundle] bundlePath], @"Path", - [NSNumber numberWithInt:0], @"Hide", - aliasData, @"AliasData", nil, nil]; + [[NSBundle mainBundle] bundlePath], @"Path", + [NSNumber numberWithInt:0], @"Hide", + [NSData data], @"AliasData", nil, nil]; [loginarray addObject:itemDict]; } else { int i; @@ -52,9 +50,11 @@ void ITSetApplicationLaunchOnLogin(NSString *path, BOOL flag) } } } + [loginwindow setObject:loginarray forKey:@"AutoLaunchedApplicationDictionary"]; [df setPersistentDomain:loginwindow forName:@"loginwindow"]; [df synchronize]; [loginwindow release]; + [loginarray release]; } BOOL ITDoesApplicationLaunchOnLogin(NSString *path)