[haiku-commits] r36848 - haiku/trunk/src/apps/installer

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 17 May 2010 21:00:07 +0200 (CEST)

Author: stippi
Date: 2010-05-17 21:00:07 +0200 (Mon, 17 May 2010)
New Revision: 36848
Changeset: http://dev.haiku-os.org/changeset/36848/haiku
Ticket: http://dev.haiku-os.org/ticket/4732

Modified:
   haiku/trunk/src/apps/installer/UnzipEngine.cpp
Log:
Patch by idefix: Change the parsing of zip output so that Installer will show
the name of extracted items when the target volume name contains spaces.
Closes ticket #4732, thanks!


Modified: haiku/trunk/src/apps/installer/UnzipEngine.cpp
===================================================================
--- haiku/trunk/src/apps/installer/UnzipEngine.cpp      2010-05-17 16:27:25 UTC 
(rev 36847)
+++ haiku/trunk/src/apps/installer/UnzipEngine.cpp      2010-05-17 19:00:07 UTC 
(rev 36848)
@@ -298,20 +298,25 @@
 status_t
 UnzipEngine::_ReadLineExtract(const BString& line)
 {
-       char item[1024];
-       char linkTarget[256];
-       const char* kCreatingFormat = "    creating: %s\n";
-       const char* kInflatingFormat = "   inflating: %s\n";
-       const char* kLinkingFormat = "     linking: %s -> %s\n";
-       if (sscanf(line.String(), kCreatingFormat, &item) == 1
-               || sscanf(line.String(), kInflatingFormat, &item) == 1
-               || sscanf(line.String(), kLinkingFormat, &item,
-                       &linkTarget) == 2) {
+       const char* kCreatingFormat = "   creating:";
+       const char* kInflatingFormat = "  inflating:";
+       const char* kLinkingFormat = "    linking:";
+       if (line.FindFirst(kCreatingFormat) == 0
+               || line.FindFirst(kInflatingFormat) == 0
+               || line.FindFirst(kLinkingFormat) == 0) {
 
                fItemsUncompressed++;
 
-               BString itemPath(item);
-               int pos = itemPath.FindLast('/');
+               BString itemPath;
+
+               int pos = line.FindLast(" -> ");
+               if (pos > 0)
+                       line.CopyInto(itemPath, 13, pos - 13);
+               else 
+                       line.CopyInto(itemPath, 13, line.CountChars() - 14);
+
+               itemPath.Trim();
+               pos = itemPath.FindLast('/');
                BString itemName = itemPath.String() + pos + 1;
                itemPath.Truncate(pos);
 
@@ -326,7 +331,7 @@
 
                _UpdateProgress(itemName.String(), itemPath.String());
        } else {
-//             printf("ignored: %s", line.String());
+//             printf("ignored: '%s'\n", line.String());
        }
 
        return B_OK;


Other related posts:

  • » [haiku-commits] r36848 - haiku/trunk/src/apps/installer - superstippi