Page MenuHome

Fix: previous/next navigation broken for the default directory.
AbandonedPublic

Authored by Nicholas Rishel (nicholas_rishel) on Sep 10 2019, 12:37 AM.

Details

Summary

Previously BKE_appdir_folder_default would return a path
trailing slash. This funtion is only used with SpaceFile's params->dir,
where dir is normally a path with trailing slash. This change makes the
default path consistent with other uses of params->dir.

This fixes previous/next navigation where stepping "back" into the
default folder was recorded as a newly visited folder, whereup the next
folder list was reset and the previous folder list became [default
folder]->[default folder with trailing slash].

Diff Detail

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.Sep 10 2019, 10:28 AM
Brecht Van Lommel (brecht) added inline comments.
source/blender/blenkernel/intern/appdir.c
79

You can't edit a const char * pointer like this.

This can be solved by doing the same as the Windows case, copying to a static char documentfolder[MAXPATHLEN]; and modifying that.

This revision now requires changes to proceed.Sep 10 2019, 10:28 AM
Nicholas Rishel (nicholas_rishel) marked an inline comment as done.EditedSep 11 2019, 11:02 PM

Updated the commit to use BLI_add_slash instead of BLI_cleanup_dir. I'm not sure this is the right decision: I'd guess this bug might resurface if e.g. HOME points to an invalid directory causing root to be used instead though I don't check that BLI_cleanup_dir would handle that case any better. The change do BLI_add_slash resolves the tested issue on Windows and Linux.

source/blender/blenkernel/intern/appdir.c
79

Resolved this along with other bugs in the Linux changes.

Nicholas Rishel (nicholas_rishel) marked an inline comment as done.

After thinking about this I think this is probably approaching the problem from the wrong end. Instead the path comparison should check if paths result in the same location, not whether the path strings are identical.