[darwinbuild-changes] [887] branches/PR-8486662/darwinup

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 28 12:52:14 PDT 2010


Revision: 887
          http://trac.macosforge.org/projects/darwinbuild/changeset/887
Author:   wsiegrist at apple.com
Date:     2010-09-28 12:52:12 -0700 (Tue, 28 Sep 2010)
Log Message:
-----------
Follow symlinks when creating Archives so we can install a symlink-to-directory

Modified Paths:
--------------
    branches/PR-8486662/darwinup/Archive.cpp
    branches/PR-8486662/darwinup/Utils.cpp
    branches/PR-8486662/darwinup/Utils.h

Modified: branches/PR-8486662/darwinup/Archive.cpp
===================================================================
--- branches/PR-8486662/darwinup/Archive.cpp	2010-09-28 19:50:13 UTC (rev 886)
+++ branches/PR-8486662/darwinup/Archive.cpp	2010-09-28 19:52:12 UTC (rev 887)
@@ -300,7 +300,7 @@
 	}
 	
 	// use file extension to guess archive format
-	if (is_directory(actpath)) {
+	if (is_directory(actpath, true)) {
 		archive = new DittoArchive(actpath);
 	} else if (has_suffix(actpath, ".cpio")) {
 		archive = new CpioArchive(actpath);

Modified: branches/PR-8486662/darwinup/Utils.cpp
===================================================================
--- branches/PR-8486662/darwinup/Utils.cpp	2010-09-28 19:50:13 UTC (rev 886)
+++ branches/PR-8486662/darwinup/Utils.cpp	2010-09-28 19:52:12 UTC (rev 887)
@@ -103,8 +103,17 @@
 }
 
 int is_directory(const char* path) {
+	return is_directory(path, false);
+}
+
+int is_directory(const char* path, bool followlinks) {
 	struct stat sb;
-	int res = lstat(path, &sb);
+	int res = 0;
+	if (followlinks) {
+		res	= stat(path, &sb);	
+	} else {
+		res = lstat(path, &sb);
+	}
 	return (res == 0 && S_ISDIR(sb.st_mode));
 }
 

Modified: branches/PR-8486662/darwinup/Utils.h
===================================================================
--- branches/PR-8486662/darwinup/Utils.h	2010-09-28 19:50:13 UTC (rev 886)
+++ branches/PR-8486662/darwinup/Utils.h	2010-09-28 19:52:12 UTC (rev 887)
@@ -62,6 +62,7 @@
 int mkdir_p(const char* path);
 int remove_directory(const char* path);
 int is_directory(const char* path);
+int is_directory(const char* path, bool followlinks);
 int is_regular_file(const char* path);
 int is_url_path(const char* path);
 int is_userhost_path(const char* path);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100928/a261d7d4/attachment-0001.html>


More information about the darwinbuild-changes mailing list