[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13447 - gnunet/src/monkey/seaspider/org/gnunet/seaspider
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13447 - gnunet/src/monkey/seaspider/org/gnunet/seaspider |
Date: |
Thu, 28 Oct 2010 19:38:58 +0200 |
Author: safey
Date: 2010-10-28 19:38:58 +0200 (Thu, 28 Oct 2010)
New Revision: 13447
Modified:
gnunet/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
Log:
Improving Seaspider's recursive method.
Modified: gnunet/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
===================================================================
--- gnunet/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
2010-10-28 16:18:41 UTC (rev 13446)
+++ gnunet/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
2010-10-28 17:38:58 UTC (rev 13447)
@@ -65,28 +65,24 @@
}
- private static void parseRecursively(String dirPath)
+ private static void parseRecursively(String path)
{
- File dir = new File(dirPath);
+ File file = new File(path);
- if (!dir.isDirectory()) {
- if (dirPath.endsWith(".c")) {
- doParseFile(dirPath);
+ if (!file.isDirectory()) {
+ if (path.endsWith(".db"))
return;
- } else /* Probably the Database file */
- return;
+ /* A source file */
+ doParseFile(path);
+ return;
}
- System.out.println("Reading from: " + dirPath + " source
directory...");
- String[] dirContents = dir.list(filter);/* Only directories and
.c files */
+ /* A source directory */
+ System.out.println("Reading from: " + path + " source
directory...");
+ String[] dirContents = file.list(filter);/* Only directories
and .c files */
for (int i = 0; i < dirContents.length; i++) {
- String fullPath = dirPath + "/" + dirContents[i];
- File file = new File(fullPath);
-
- if (file.isDirectory())
- parseRecursively(fullPath);
- else
- doParseFile(fullPath); /* Path is for a file */
+ String fullPath = path + "/" + dirContents[i];
+ parseRecursively(fullPath);
}
}
@@ -109,8 +105,10 @@
/* Should be a valid path for a file or a directory */
File file = new File(args[i]);
if (!file.exists()) {
- System.err.println("\"" + args[i]+ "\" is an invalid
file or directory location");
+ System.err.println("\"" + args[i] + "\" is an invalid
file or directory location");
System.exit(1);
+ } else if (!file.isDirectory() && !args[i].endsWith(".c")) {
+ System.err.println("\"" + args[i] + "\" only source
files can be parsed");
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13447 - gnunet/src/monkey/seaspider/org/gnunet/seaspider,
gnunet <=