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

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 26 Apr 2010 00:00:47 +0200 (CEST)

Author: korli
Date: 2010-04-26 00:00:47 +0200 (Mon, 26 Apr 2010)
New Revision: 36475
Changeset: http://dev.haiku-os.org/changeset/36475/haiku
Ticket: http://dev.haiku-os.org/ticket/5806

Modified:
   haiku/trunk/src/apps/installer/CopyEngine.cpp
   haiku/trunk/src/apps/installer/CopyEngine.h
   haiku/trunk/src/apps/installer/WorkerThread.cpp
Log:
Should fix #5806. CollectTargets() is also called for packages, the 
fVarDirectory init is moved to ResetTargets().


Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp
===================================================================
--- haiku/trunk/src/apps/installer/CopyEngine.cpp       2010-04-25 17:33:13 UTC 
(rev 36474)
+++ haiku/trunk/src/apps/installer/CopyEngine.cpp       2010-04-25 22:00:47 UTC 
(rev 36475)
@@ -79,7 +79,7 @@
 
 
 void
-CopyEngine::ResetTargets()
+CopyEngine::ResetTargets(const char* source)
 {
        // TODO: One could subtract the bytes/items which were added to the
        // ProgressReporter before resetting them...
@@ -98,27 +98,25 @@
 
        fCurrentTargetFolder = NULL;
        fCurrentItem = NULL;
+       
+       // init BEntry pointing to /var
+       // There is no other way to retrieve the path to the var folder
+       // on the source volume. Using find_directory() with
+       // B_COMMON_VAR_DIRECTORY will only ever get the var folder on the
+       // current /boot volume regardless of the volume of "source", which
+       // makes sense, since passing a volume is meant to folders that are
+       // volume specific, like "trash".
+       BPath path(source);
+       if (path.Append("common/var") == B_OK)
+               fVarDirectory.SetTo(path.Path());
+       else
+               fVarDirectory.Unset();
 }
 
 
 status_t
 CopyEngine::CollectTargets(const char* source, sem_id cancelSemaphore)
 {
-       // init BEntry pointing to /var
-       {
-               // There is no other way to retrieve the path to the var folder
-               // on the source volume. Using find_directory() with
-               // B_COMMON_VAR_DIRECTORY will only ever get the var folder on 
the
-               // current /boot volume regardless of the volume of "source", 
which
-               // makes sense, since passing a volume is meant to folders that 
are
-               // volume specific, like "trash".
-               BPath path(source);
-               if (path.Append("common/var") == B_OK)
-                       fVarDirectory.SetTo(path.Path());
-               else
-                       fVarDirectory.Unset();
-       }
-
        int32 level = 0;
        status_t ret = _CollectCopyInfo(source, level, cancelSemaphore);
        if (ret == B_OK && fProgressReporter != NULL)
@@ -535,7 +533,7 @@
        }
        if (fVarDirectory == entry) {
                // current location of var
-               printf("ignoring '%s'.\n", name);
+               printf("ignoring common/'%s'.\n", name);
                return false;
        }
        return true;

Modified: haiku/trunk/src/apps/installer/CopyEngine.h
===================================================================
--- haiku/trunk/src/apps/installer/CopyEngine.h 2010-04-25 17:33:13 UTC (rev 
36474)
+++ haiku/trunk/src/apps/installer/CopyEngine.h 2010-04-25 22:00:47 UTC (rev 
36475)
@@ -23,7 +23,7 @@
                                                                
CopyEngine(ProgressReporter* reporter);
        virtual                                         ~CopyEngine();
 
-                       void                            ResetTargets();
+                       void                            ResetTargets(const 
char* source);
                        status_t                        CollectTargets(const 
char* source,
                                                                        sem_id 
cancelSemaphore = -1);
 

Modified: haiku/trunk/src/apps/installer/WorkerThread.cpp
===================================================================
--- haiku/trunk/src/apps/installer/WorkerThread.cpp     2010-04-25 17:33:13 UTC 
(rev 36474)
+++ haiku/trunk/src/apps/installer/WorkerThread.cpp     2010-04-25 22:00:47 UTC 
(rev 36475)
@@ -382,12 +382,12 @@
                goto error;
        }
 
-       // Begin actuall installation
+       // Begin actual installation
 
        _LaunchInitScript(targetDirectory);
 
        // let the engine collect information for the progress bar later on
-       engine.ResetTargets();
+       engine.ResetTargets(srcDirectory.Path());
        err = engine.CollectTargets(srcDirectory.Path(), fCancelSemaphore);
        if (err != B_OK)
                goto error;


Other related posts:

  • » [haiku-commits] r36475 - haiku/trunk/src/apps/installer - korli