From 8c432bfe8aa0fa02c051af3fe10971cf47577d13 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Fri, 3 Jul 2015 16:18:02 -0400 Subject: [PATCH] better path handling of processes --- Classes/mysqlPref.m | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Classes/mysqlPref.m b/Classes/mysqlPref.m index da0d6b5..851489a 100644 --- a/Classes/mysqlPref.m +++ b/Classes/mysqlPref.m @@ -45,9 +45,17 @@ - (void)mainViewDidLoad { //NSLog(@"arguments (MySQL): %@", arguments); NSString *lp = [[MSPPPreferences sharedPreferences] objectForUserDefaultsKey:@"launchPath"]; + if ([lp hasSuffix:@"/"]) + { + daemonController.launchPathStart = [lp stringByAppendingString:@"mysqld_safe"]; + daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; + } + else + { + daemonController.launchPathStart = [lp stringByAppendingString:@"/mysqld_safe"]; + daemonController.launchPath = [lp stringByAppendingString:@"/mysqld"]; + } - daemonController.launchPathStart = [lp stringByAppendingString:@"mysqld_safe"]; - daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; daemonController.startArguments = arguments; [versionText setTitle:version]; @@ -109,7 +117,14 @@ - (IBAction)startStopDaemon:(id)sender { NSMutableArray *arguments = (NSMutableArray *)[[MSPPPreferences sharedPreferences] argumentsWithParameters]; NSString *lp = [[MSPPPreferences sharedPreferences] objectForUserDefaultsKey:@"launchPath"]; - daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; + if ([lp hasSuffix:@"/"]) + { + daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; + } + else + { + daemonController.launchPath = [lp stringByAppendingString:@"/mysqld"]; + } daemonController.startArguments = arguments; if (theSlider.state == NSOffState) @@ -125,7 +140,14 @@ - (IBAction)clickOnOff:(id)sender { NSMutableArray *arguments = (NSMutableArray *)[[MSPPPreferences sharedPreferences] argumentsWithParameters]; NSString *lp = [[MSPPPreferences sharedPreferences] objectForUserDefaultsKey:@"launchPath"]; - daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; + if ([lp hasSuffix:@"/"]) + { + daemonController.launchPath = [lp stringByAppendingString:@"mysqld"]; + } + else + { + daemonController.launchPath = [lp stringByAppendingString:@"/mysqld"]; + } daemonController.startArguments = arguments; int tag = (int)[sender tag];