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

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 19 Jan 2010 20:21:48 +0100 (CET)

Author: stippi
Date: 2010-01-19 20:21:48 +0100 (Tue, 19 Jan 2010)
New Revision: 35175
Changeset: http://dev.haiku-os.org/changeset/35175/haiku

Modified:
   haiku/trunk/src/apps/installer/CopyEngine.cpp
   haiku/trunk/src/apps/installer/CopyEngine.h
Log:
Installer cannot use find_directory(), since it needs to support source volumes
other than /boot. That's why it worked like it did in the first place. Some
folders like "trash" can be volume specific, but most others are not and the
volume passed to find_directory() is ignored (which makes sense).


Modified: haiku/trunk/src/apps/installer/CopyEngine.cpp
===================================================================
--- haiku/trunk/src/apps/installer/CopyEngine.cpp       2010-01-19 19:13:25 UTC 
(rev 35174)
+++ haiku/trunk/src/apps/installer/CopyEngine.cpp       2010-01-19 19:21:48 UTC 
(rev 35175)
@@ -13,7 +13,6 @@
 #include <sys/resource.h>
 
 #include <Directory.h>
-#include <FindDirectory.h>
 #include <fs_attr.h>
 #include <NodeInfo.h>
 #include <Path.h>
@@ -63,11 +62,6 @@
        rl.rlim_cur = 512;
        rl.rlim_max = RLIM_SAVED_MAX;
        setrlimit(RLIMIT_NOFILE, &rl);
-
-       // init BEntry pointing to /var
-       BPath path;
-       if (find_directory(B_COMMON_VAR_DIRECTORY, &path) == B_OK)
-               fVarDirectory.SetTo(path.Path());
 }
 
 
@@ -110,6 +104,21 @@
 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)

Modified: haiku/trunk/src/apps/installer/CopyEngine.h
===================================================================
--- haiku/trunk/src/apps/installer/CopyEngine.h 2010-01-19 19:13:25 UTC (rev 
35174)
+++ haiku/trunk/src/apps/installer/CopyEngine.h 2010-01-19 19:21:48 UTC (rev 
35175)
@@ -109,6 +109,7 @@
                        ProgressReporter*       fProgressReporter;
 
        // TODO: Should be made into a list of BEntris to be ignored, perhaps.
+       // settable by method...
                        BEntry                          fVarDirectory;
 };
 


Other related posts:

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