Convert macOS paths from relative to absolute
ClosedPublic

Authored by Arto Kitula (akitula) on Aug 9 2017, 2:28 PM.

Details

Summary

Call realpath to parse . and .. from both blender binary location and Resources to get absolute paths

This is needed to get absolute directories from bpy.app.binary_path (and _python) and bpy.utils.script_paths()
script_load_module tests will fail because script_paths() returns

/directory/blender.app/Contents/MacOS/../Resources/scripts/modules

and

/directory/blender.app/Contents/Resources/scripts

When testing, modules are done with recursive search and since Contents/MacOS/../Resources/script/modules and Contents/Resources/script/modules aren't considered as same thing, we'll get modules twice.

Diff Detail

cleanup with BLI_* functions rather than realpath to keep symlinkin ok.

Why do we need this change? What issue it addresses form user perspective?

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

Space after comma.

596

Indentation.

597

Space after comma, same in the line below.

Arto Kitula (akitula) edited the summary of this revision. (Show Details)Aug 9 2017, 4:38 PM
Arto Kitula (akitula) edited the summary of this revision. (Show Details)
Arto Kitula (akitula) edited the summary of this revision. (Show Details)Aug 9 2017, 4:43 PM
Arto Kitula (akitula) marked an inline comment as done.

cleanup

From implementation point of view don't really anything to comment. Don't know if there's shorter way to do this. If it works, guess it's fine.

But maybe also wait for @Campbell Barton (campbellbarton) to reply.

Arto Kitula (akitula) marked 2 inline comments as done.Aug 10 2017, 11:34 AM

Fixes done

source/blender/blenkernel/intern/appdir.c
596–599

Would be good to have comment in code what the purpose of this block is.

This is confusing, why is it making an absolute path using its self as the basepath argument?

source/blender/blenkernel/intern/appdir.c
596–599

Actually just calling BLI_cleanup_path(name, fullname) does the work here also.

use BLI_cleanup_paths on both, Resources and where_am_i functions.

Generally looks fine, one last comment.

source/blender/blenkernel/intern/appdir.c
596–599

If this is just a cleanup, probably it should run on all systems? - not just apple.

where_am_i cleanup can be run on every platform.

source/blender/blenkernel/intern/appdir.c
596–599

This will call BLI_path_abs wont BLI_cleanup_path(NULL, fullname); work as well?

Wondering why name would be the relabase of fullname.

Arto Kitula (akitula) marked 4 inline comments as done.Aug 10 2017, 7:41 PM
This revision is now accepted and ready to land.Aug 11 2017, 12:50 AM