project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java
changeset 559 9198c2581dd6
parent 553 fe69ca72a1a0
child 674 20c7966a3405
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Mon Nov 02 08:19:18 2009 -0600
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Mon Nov 02 09:48:03 2009 -0600
@@ -52,7 +52,6 @@
     private Text projectName;
     private Text rootDirectory;
     private Button browseButton;
-    private long MAX_FILE_COUNT_UNDER_ROOT = 20000;
     
     String projectNameText = ""; //$NON-NLS-1$
     IPath rootDirectoryPath = null;
@@ -254,40 +253,25 @@
 			return true;
 		}
 		
-		if (rootDirectoryPath.isRoot()){
-			long resCount = countFilesRecursivelyWithMax(rootDirectoryPath.toFile(), 0);
-			// Don't show warning, if by chance there's few sources under the root
-			if (resCount >= MAX_FILE_COUNT_UNDER_ROOT){
+		if (rootDirectoryPath.isRoot() || rootDirectoryPath.segmentCount() == 1){
+				
+			if (rootDirectoryPath.segmentCount() == 1){
+				for (ISymbianBuildContext context : parsedWithConfigs){
+					IPath sdkRoot = new Path(context.getSDK().getEPOCROOT());
+					if (rootDirectoryPath.isPrefixOf(sdkRoot) || sdkRoot.isPrefixOf(rootDirectoryPath)){
+						setMessage(Messages.ProjectPropertiesPage_directoryIsRoot, IStatus.WARNING);
+						break;
+					}
+				}
+			} else {
 				setMessage(Messages.ProjectPropertiesPage_directoryIsRoot, IStatus.WARNING);
 			}
-			return true;
+			
 		}
 		
 		return true;
     }
     
-    /**
-     * Recursively count the # of files under a given directory. Stops counting when count >= MAX_FILE_COUNT_UNDER_ROOT
-     * @param directory - Start directory
-     * @param start count, current count
-     * @return
-     */
-    private long countFilesRecursivelyWithMax(File directory, long inCount) {
-    	if (inCount >= MAX_FILE_COUNT_UNDER_ROOT) 
-    		return MAX_FILE_COUNT_UNDER_ROOT;
-    	if (directory.isDirectory()) {
-            String[] children = directory.list();
-            inCount = children.length + inCount; // increment the file count for this directory
-            for (int i=0; i<children.length; i++) {
-            	inCount = countFilesRecursivelyWithMax(new File(directory, children[i]), inCount);
-            }
-
-            return inCount; // return current file count
-        }
-    	return inCount; // return current file count
-
-	}
-    
     public String getProjectName() {
     	return projectNameText;
     }