Use GetPath accessor outside of filetree package

In preparation of making it private to the package.
This commit is contained in:
Stefan Haller 2025-02-28 21:12:10 +01:00
parent 2dfc3491bd
commit 53090b2c45
3 changed files with 6 additions and 6 deletions

View file

@ -231,7 +231,7 @@ func (self *CommitFilesController) openCopyMenu() error {
copyPathItem := &types.MenuItem{
Label: self.c.Tr.CopyFilePath,
OnPress: func() error {
if err := self.c.OS().CopyToClipboard(node.Path); err != nil {
if err := self.c.OS().CopyToClipboard(node.GetPath()); err != nil {
return err
}
self.c.Toast(self.c.Tr.FilePathCopiedToast)

View file

@ -410,7 +410,7 @@ func (self *FilesController) pressWithLock(selectedNodes []*filetree.FileNode) e
toPaths := func(nodes []*filetree.FileNode) []string {
return lo.Map(nodes, func(node *filetree.FileNode, _ int) string {
return node.Path
return node.GetPath()
})
}
@ -881,7 +881,7 @@ func (self *FilesController) openDiffTool(node *filetree.FileNode) error {
return self.c.RunSubprocessAndRefresh(
self.c.Git().Diff.OpenDiffToolCmdObj(
git_commands.DiffToolCmdOptions{
Filepath: node.Path,
Filepath: node.GetPath(),
FromCommit: fromCommit,
ToCommit: "",
Reverse: reverse,
@ -979,7 +979,7 @@ func (self *FilesController) openCopyMenu() error {
copyPathItem := &types.MenuItem{
Label: self.c.Tr.CopyFilePath,
OnPress: func() error {
if err := self.c.OS().CopyToClipboard(node.Path); err != nil {
if err := self.c.OS().CopyToClipboard(node.GetPath()); err != nil {
return err
}
self.c.Toast(self.c.Tr.FilePathCopiedToast)

View file

@ -293,7 +293,7 @@ func getColorForChangeStatus(changeStatus string) style.TextStyle {
}
func fileNameAtDepth(node *filetree.Node[models.File], depth int) string {
splitName := split(node.Path)
splitName := split(node.GetPath())
name := join(splitName[depth:])
if node.File != nil && node.File.IsRename() {
@ -314,7 +314,7 @@ func fileNameAtDepth(node *filetree.Node[models.File], depth int) string {
}
func commitFileNameAtDepth(node *filetree.Node[models.CommitFile], depth int) string {
splitName := split(node.Path)
splitName := split(node.GetPath())
name := join(splitName[depth:])
return name