def get_path(dest, file, cwd = None):
	"""Get the writing path of a file."""
	if callable(dest):
		return dest(file)

	if not cwd:
		cwd = file.cwd
	if not os.path.isabs(dest):
		dest = os.path.join(cwd, dest)

	relative = os.path.relpath(file.path, file.base)
	return os.path.join(dest, relative)