# Path: sunflower/common.py
# def decode_file_name(file_name):
# 	"""Replace surrogate codepoints in a filename with a replacement character
# 	to display non-UTF-8 filenames."""
# 	if isinstance(file_name, bytes):
# 		return file_name.decode('utf-8', 'replace')
# 
# 	return decode_file_name(encode_file_name(file_name))


import os
from gi.repository import Gtk, GObject
from sunflower.common import decode_file_name

		if self._path is not None and self._path.startswith(path):
			# path is a subset, update highlight and exit
			for control in self.box.get_children():
				if control.path == path:
					self._focus_fragment(control, is_new=False)
					break

		else:
			# prepare for parsing
			self._path = path
			self.box.foreach(self.box.remove)

			# split root element from others
			root_element = provider.get_root_path(path)
			other_elements = path[len(root_element):]

			# make sure our path doesn't begin with slash
			if other_elements.startswith(os.path.sep):
				other_elements = other_elements[1:]

			# split elements
			elements = other_elements.split(os.path.sep)
			elements.insert(0, root_element)

			# create controls
			control = None
			current_path = None
			for element in elements:
				current_path = os.path.join(current_path, element) if current_path is not None else element

# Path: sunflower/common.py
# def decode_file_name(file_name):
# 	"""Replace surrogate codepoints in a filename with a replacement character
# 	to display non-UTF-8 filenames."""
# 	if isinstance(file_name, bytes):
# 		return file_name.decode('utf-8', 'replace')
# 
# 	return decode_file_name(encode_file_name(file_name))


# Path: sunflower/widgets/breadcrumbs.py
import os
from gi.repository import Gtk, GObject
from sunflower.common import decode_file_name


		if self._path is not None and self._path.startswith(path):
			# path is a subset, update highlight and exit
			for control in self.box.get_children():
				if control.path == path:
					self._focus_fragment(control, is_new=False)
					break

		else:
			# prepare for parsing
			self._path = path
			self.box.foreach(self.box.remove)

			# split root element from others
			root_element = provider.get_root_path(path)
			other_elements = path[len(root_element):]

			# make sure our path doesn't begin with slash
			if other_elements.startswith(os.path.sep):
				other_elements = other_elements[1:]

			# split elements
			elements = other_elements.split(os.path.sep)
			elements.insert(0, root_element)

			# create controls
			control = None
			current_path = None
			for element in elements:
				current_path = os.path.join(current_path, element) if current_path is not None else element

				control = Fragment(decode_file_name(element), current_path, self.__fragment_click, control)