Apparently BeOS's BPath constructor doesn't actually _need_ leaf to be
authorRyan C. Gordon <icculus@icculus.org>
Sun, 05 Nov 2006 19:06:23 +0000
changeset 788 3df4f1b61339
parent 787 81da113b878f
child 789 ede0553c4232
Apparently BeOS's BPath constructor doesn't actually _need_ leaf to be manually split out.
CHANGELOG
platform/beos.cpp
--- a/CHANGELOG	Sun Nov 05 11:32:18 2006 +0000
+++ b/CHANGELOG	Sun Nov 05 19:06:23 2006 +0000
@@ -3,6 +3,7 @@
  */
 
 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work.
+           Minor BeOS realpath tweak.
 09272006 - Reworked 7zip archiver (thanks, Dennis!).
 09232006 - Fixed typo in doxygen comment.
 04112006 - Added LZMA archiver...7zip support (thanks, Dennis!).
--- a/platform/beos.cpp	Sun Nov 05 11:32:18 2006 +0000
+++ b/platform/beos.cpp	Sun Nov 05 19:06:23 2006 +0000
@@ -200,14 +200,7 @@
 
 char *__PHYSFS_platformRealPath(const char *path)
 {
-    char *str = (char *) alloca(strlen(path) + 1);
-    BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, NULL);
-    strcpy(str, path);
-    char *leaf = strrchr(str, '/');
-    if (leaf != NULL)
-        *(leaf++) = '\0';
-
-    BPath normalized(str, leaf, true);  /* force normalization of path. */
+    BPath normalized(path, NULL, true);  /* force normalization of path. */
     const char *resolved_path = normalized.Path();
     BAIL_IF_MACRO(resolved_path == NULL, ERR_NO_SUCH_FILE, NULL);
     char *retval = (char *) allocator.Malloc(strlen(resolved_path) + 1);