BOOL isValidParameters()

in tools/ROADAttributesCodeGenerator/ROADAttributesCodeGenerator/main.m [67:104]


BOOL isValidParameters(RFArgumentResolver *cmdLineArguments) {
    if ([cmdLineArguments.sourcePaths count] < 1) {
        [RFConsole writeLine:@"ERROR: Path to source code was not specified"];
        return NO;
    }
    for (NSString *sourcePath in cmdLineArguments.sourcePaths) {
        if ([NSString isNilOrEmpty:sourcePath]) {
            [RFConsole writeLine:@"ERROR: Path to source code was not specified"];
            return NO;
        }
    }
    
    if ([NSString isNilOrEmpty:cmdLineArguments.destinationPath]) {
        [RFConsole writeLine:@"ERROR: Path to destination folder was not specified"];
        return NO;
    }

    for (NSString *sourcePath in cmdLineArguments.sourcePaths) {
        if (![NSFileManager isFolderAtPath:sourcePath]) {
            [RFConsole writeLine:[NSString stringWithFormat:@"ERROR: Path to source code doesn't point to directory (%@)", sourcePath]];
            return NO;
        }
    }
    
    if (![NSFileManager isFolderAtPath:cmdLineArguments.destinationPath]) {
        [RFConsole writeLine:[NSString stringWithFormat:@"ERROR: Path to destination folder doesn't point to directory (%@)", cmdLineArguments.destinationPath]];
        return NO;
    }

    for (NSString *definePath in cmdLineArguments.definePaths) {
        if (![NSFileManager isFileAtPath:definePath]) {
            [RFConsole writeLine:[NSString stringWithFormat:@"ERROR: Path to define file doesn't point to file (%@)", definePath]];
            return NO;
        }
    }

    return YES;
}