Mercurial > repos > blastem
comparison util.c @ 1039:86ed81bb574f
Fix bug in ensure_dir_exists that would cause it to fail when mixed path separators were used
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 19 Jul 2016 21:57:23 -0700 |
parents | 4a92889e2889 |
children | 266dc3f31f35 |
comparison
equal
deleted
inserted
replaced
1038:07a65e2ffb1f | 1039:86ed81bb574f |
---|---|
336 char *parent = strdup(path); | 336 char *parent = strdup(path); |
337 //Windows technically supports both native and Unix-style path separators | 337 //Windows technically supports both native and Unix-style path separators |
338 //so search for both | 338 //so search for both |
339 char *sep = strrchr(parent, '\\'); | 339 char *sep = strrchr(parent, '\\'); |
340 char *osep = strrchr(parent, '/'); | 340 char *osep = strrchr(parent, '/'); |
341 if (osep && (!sep || osep < sep)) { | 341 if (osep && (!sep || osep > sep)) { |
342 sep = osep; | 342 sep = osep; |
343 } | 343 } |
344 if (!sep || sep == parent) { | 344 if (!sep || sep == parent) { |
345 //relative path, but for some reason we failed | 345 //relative path, but for some reason we failed |
346 return 0; | 346 return 0; |