pharo-contributions / file-dialog-transfered-to-newtools

Replacement for Pharo's native dialog
MIT License
8 stars 9 forks source link

When moving in the file system, '..' directory can get concatenated several times in path preview #8

Closed juliendelplanque closed 6 years ago

juliendelplanque commented 6 years ago

Maybe the file reference used internally should be resolved before displaying it?

screen shot 2017-12-01 at 17 03 33

apblack commented 6 years ago

This is actually a bug. The example above shows more ../ segments than are being utilized when navigating to the directory that is displayed. If you evaluate the file path that is returned from the dialog, you are several levels "up" from /, and the file can't be opened.

peteruhnak commented 6 years ago

Thanks for the report, apparently Pharo 7 changed how asFileReference works and instead added canonicalize.

apblack commented 6 years ago

Thanks for the fix. But .. is more complicated than I realized. I have a symlink

/Users/black/graceProgs -> /Users/black/Andrew Black/technical/Grace/sample code/

So in Darwin, at least, /Users/black/graceProgs/.. is /Users/black/, while /Users/black/Andrew Black/technical/Grace/sample code/.. is /Users/black/Andrew Black/technical/Grace/. But when one looks at /Users/black/graceProgs/ and /Users/black/Andrew Black/technical/Grace/sample code/ with FileDialog one sees the same directory, and clicking the .. icon takes one to the same place ... which seems entirely reasonable. It's just not the behavior of Darwin.

I've no idea if other Unixes do this too — canonicalizing the pathname before doing the lookup, rather than just following the path that at the user provides.