Commit 3e89a302 authored by Tien's avatar Tien

Fix scan files with the same name

parent 8acdd478
......@@ -2,6 +2,9 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/home/tien/masterscidetect/scidetect/src/fr/imag/forge/scidetect/Checker/Reader.java</file>
<file>file:/home/tien/masterscidetect/scidetect/src/fr/imag/forge/scidetect/Corpus/TextProcessor.java</file>
</group>
</open-files>
</project-private>
......@@ -37,7 +37,8 @@ public class Indexer {
* @throws FileNotFoundException
*/
public void index(String content, File textfile) throws FileNotFoundException {
String filename = textfile.getName().substring(0,textfile.getName().lastIndexOf("."));
String filename = textfile.getName();
//String filename = textfile.getName().substring(0,textfile.getName().lastIndexOf("."));
filename+=".txt";
String path = textfile.getParent();
......
......@@ -59,11 +59,10 @@ public class TextProcessor {
public ArrayList<Text> newtext(File original, File[] listOfFile) throws IOException {
// find if there is already index for it
String indexname = "INDEX-"
+ original.getName().substring(0,
original.getName().lastIndexOf("."))
+ original.getName()
+ ".txt";
String content = "";
if (Arrays.asList(listOfFile).toString().contains(indexname)) {
// System.out.println("lets read from index file");
readindexfile(original.getParent() + "/" + indexname);
......@@ -98,11 +97,9 @@ public class TextProcessor {
String[] part = splitcontent(content);
for (int i = 0; i < part.length; i++) {
String indexnameparti = "INDEX-"
+ original.getName().substring(0,
original.getName().lastIndexOf("."))
+ "_part" + i + ".txt";
String filename = original.getName().substring(0,
original.getName().lastIndexOf("."))
+ original.getName()
+ "_part" + i + ".txt.txt";
String filename = original.getName()
+ "_part" + i + ".txt";
Indexer b = new Indexer();
File a = new File(original.getParent() + "/" + filename);
......
......@@ -104,6 +104,7 @@ public class SciDetect_Local {
tests = reader.readtests(testpath);
} catch (Exception e) {
e.printStackTrace();
System.out.println("* Something went wrong during:");
System.out.println(" - reading the config file");
System.out.println(" - or reading the samples (dir data)");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment