def setup_paths(source, destination, name, add_to_global, force):
if source[-<NUM_LIT:1>] == "<STR_LIT:/>":<EOL><INDENT>source = source[:-<NUM_LIT:1>]<EOL><DEDENT>if not name:<EOL><INDENT>name = os.path.split(source)[-<NUM_LIT:1>]<EOL><DEDENT>elif name.endswith("<STR_LIT>"):<EOL><INDENT>name = name.replace("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>if add_to_global:<EOL><INDENT>destination = DEFAULT_DOCSET_PATH<EOL><DEDENT>dest = os.path.join(destination or "<STR_LIT>", name + "<STR_LIT>")<EOL>dst_exists = os.path.lexists(dest)<EOL>if dst_exists and force:<EOL><INDENT>shutil.rmtree(dest)<EOL><DEDENT>elif dst_exists:<EOL><INDENT>log.error(<EOL>'<STR_LIT>'.format(<EOL>click.format_filename(dest)<EOL>)<EOL>)<EOL>raise SystemExit(errno.EEXIST)<EOL><DEDENT>return source, dest, name<EOL>
Determine source and destination using the options.