summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java b/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
index 0c1968eaf..c9b54c6d5 100644
--- a/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
+++ b/src/monkey/seaspider/org/gnunet/seaspider/Seaspider.java
@@ -65,28 +65,24 @@ public class Seaspider {
}
- 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);
- return;
- } else /* Probably the Database file */
+ if (!file.isDirectory()) {
+ if (path.endsWith(".db"))
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 @@ public class Seaspider {
/* 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");
}
}
}