# Check the access to the source binlog directory.
        binlog_dir = check_dir_option(parser,
                                      opt.binlog_dir,
                                      '--binlog-dir',
                                      check_access=True,
                                      read_only=True)

    # Check destination directory.
    num_args = len(args)
    if num_args < 1:
        parser.error("You must specify the destination directory as argument.")
    elif num_args > 1:
        parser.error("You can only specify one destination directory. "
                     "Multiple arguments found.")
    else:
        destination = get_absolute_path(args[0])
        if not os.path.isdir(destination):
            parser.error("The destination path specified as argument is not a "
                         "valid directory: {0}".format(args[0]))
        if not os.access(destination, os.R_OK | os.W_OK):
            parser.error("You do not have enough privileges to access the "
                         "specified destination directory: "
                         "{0}.".format(args[0]))

    # Check specified path for the binlog index file.
    bin_log_index_file = None
    if opt.bin_log_index:
        bin_log_index_file = get_absolute_path(opt.bin_log_index)
        if not os.path.isfile(bin_log_index_file):
            parser.error("The specified value for --bin-index is not a "
                         "file: {0}".format(opt.bin_log_index))
 def test_paths(self):
     """Test POSIX paths.
     """
     for source, expected in self.paths:
         self.assertEqual(get_absolute_path(source), expected)
    # Check specified source binlog directory.
    binlog_dir = None
    if opt.binlog_dir:
        # Check the access to the source binlog directory.
        binlog_dir = check_dir_option(parser, opt.binlog_dir, '--binlog-dir',
                                      check_access=True, read_only=True)

    # Check destination directory.
    num_args = len(args)
    if num_args < 1:
        parser.error("You must specify the destination directory as argument.")
    elif num_args > 1:
        parser.error("You can only specify one destination directory. "
                     "Multiple arguments found.")
    else:
        destination = get_absolute_path(args[0])
        if not os.path.isdir(destination):
            parser.error("The destination path specified as argument is not a "
                         "valid directory: {0}".format(args[0]))
        if not os.access(destination, os.R_OK | os.W_OK):
            parser.error("You do not have enough privileges to access the "
                         "specified destination directory: "
                         "{0}.".format(args[0]))

    # Check specified path for the binlog index file.
    bin_log_index_file = None
    if opt.bin_log_index:
        bin_log_index_file = get_absolute_path(opt.bin_log_index)
        if not os.path.isfile(bin_log_index_file):
            parser.error("The specified value for --bin-index is not a "
                         "file: {0}".format(opt.bin_log_index))
 def test_paths(self):
     """Test POSIX paths.
     """
     for source, expected in self.paths:
         self.assertEqual(get_absolute_path(source), expected)