[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44725] trunk/blender/source: use BLI_path_cmp() rather then strcmp()

Campbell Barton ideasman42 at gmail.com
Thu Mar 8 15:46:54 CET 2012


Before testing with BLI_path_cmp() its up to each caller to run
BLI_path_abs on each path,
this normalizes the path (removes /../../ ) and switches slashes to
the OS native.

If there are relative path comparing with absolute - those need to be
fixed or commented as exceptions to the rule.

We could test if both files are in fact the same (something like
pythons os.path.samefile(), but we may be dealing with paths that are
not yet written, and that also means you cant trick blender with
symlinks - which can come in handy).

On Thu, Mar 8, 2012 at 10:11 PM, Antony Riakiotakis <kalast at gmail.com> wrote:
> ...which is defined as strcmp anyway or BLI_strcasecmp depending on
> OS. This caused a minor compile error for windows(solved) because
> BLI_string.h is not included by default. Also in my opinion using a
> straight string compare for paths is bound to cause trouble across
> operating systems when using relative paths for instance. I could be
> wrong here of course, as I haven't actually checked if any conversion
> to '/' vs '\' is done internally for instance.
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs



-- 
- Campbell


More information about the Bf-committers mailing list