def short_path(self, name=True): path = self.file_path if not name: path = os.path.dirname(path) if self.project.path and path.startswith(self.project.path + os.path.sep): path = path[len(self.project.path) + 1:] return user_path(path)
def pretty_path(self, document): """Get the path of this document relative to this app's temp dir""" path = document.file_path if path.startswith(self.tmp): return path[len(self.tmp):] return user_path(path)
def windowTitleForDocumentDisplayName_(self, name): view = self.editor.current_view if view is not None and view.file_path is not None: return user_path(view.file_path) return name
def tooltip_for_item(self, view, item): it = view.realItemForOpaqueItem_(item) null = it is None or it.file_path is None return None if null else user_path(it.file_path)
def test(input, output): eq_(user_path(input), output)
def _default_project_path(editor=None): if editor is None or editor.project is None or editor.project.path is None: return None return user_path(editor.project.path)