changeset 106:95fb1bcf7e24

Constant for turning follow symlinks on and off.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Tue, 18 Feb 2014 17:05:48 +0100
parents 0df1552123e7
children d434137e296d
files DataController.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/DataController.cpp	Tue Feb 18 17:03:40 2014 +0100
+++ b/DataController.cpp	Tue Feb 18 17:05:48 2014 +0100
@@ -27,6 +27,7 @@
 
 void DataController::findFiles(const QDir& dir, QStringList& list)
 {
+  const bool FOLLOW_SYMLINKS = false;
 #if USE_BOOST_FIND
   namespace fs = boost::filesystem;
   fs::path someDir(dir.path().toStdString());
@@ -45,10 +46,13 @@
 	std::cout << e.what() << std::endl;
       }
       if (!wpath.empty()) {
-	if (fs::is_directory(dir_iter->status()) ) {
+	if (fs::is_directory(FOLLOW_SYMLINKS?
+			     dir_iter->status():
+			     dir_iter->symlink_status())
+	    ) {
 	  findFiles(QString::fromStdWString(wpath), list);
 	}
-	if (fs::is_regular_file(dir_iter->symlink_status()) ) {
+	else if (fs::is_regular_file(dir_iter->symlink_status()) ) {
 	  list << QString::fromStdWString(wpath);
 	}
       }