Skip to content

Commit

Permalink
bugfix create LaunchAgents directory
Browse files Browse the repository at this point in the history
create an LaunchAgents directory when it is not there (e.g. clean
install of OSX)
  • Loading branch information
Waitsnake committed Sep 4, 2016
1 parent 4f95804 commit 0c7e31e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Binary file not shown.
10 changes: 10 additions & 0 deletions AnimatedGif/AnimatedGifView.m
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,16 @@ - (void)loadAgent {
// create the plist agent file
NSMutableDictionary *plist = [[NSMutableDictionary alloc] init];

// check if LaunchAgend directory is there or not
NSString *userLaunchAgentsDir = [[NSString alloc] initWithFormat:@"%@%@%@", @"/Users/", NSUserName(), @"/Library/LaunchAgents"];
BOOL launchAgentDirExists = [[NSFileManager defaultManager] fileExistsAtPath:userLaunchAgentsDir];
if (launchAgentDirExists == NO)
{
// if directory is not there create it
[[NSFileManager defaultManager] createDirectoryAtPath:userLaunchAgentsDir withIntermediateDirectories:YES attributes:nil error:nil];
}


// set values here...
NSDictionary *cfg = @{@"Label":@"com.stino.animatedgif", @"ProgramArguments":@[@"/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine",@"-background"], @"KeepAlive":@{@"OtherJobEnabled":@{@"com.apple.SystemUIServer.agent":@YES,@"com.apple.Finder":@YES,@"com.apple.Dock.agent":@YES}}, @"ThrottleInterval":@0};
[plist addEntriesFromDictionary:cfg];
Expand Down
Binary file modified Release/AnimatedGif.saver.zip
Binary file not shown.

0 comments on commit 0c7e31e

Please sign in to comment.