Change export directory

This commit is contained in:
Quentin Legot 2023-03-24 09:05:44 +01:00
parent 505c1a9729
commit 97bdda71ce
2 changed files with 7 additions and 7 deletions

2
.gitignore vendored
View File

@ -6,5 +6,5 @@ build
bin/
.idea
.project
data.csv
export
.vscode

View File

@ -1,11 +1,10 @@
package fr.ntr;
import java.io.FileNotFoundException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -56,11 +55,12 @@ public class AccessPoint {
*/
public void startSimulation(int duration) {
try{
Files.deleteIfExists(Paths.get("data.csv"));
this.outputDataFile = new FileOutputStream("data.csv", true);
Files.deleteIfExists(Paths.get("export", this.users.size() + ".csv"));
new File("export").mkdir();
this.outputDataFile = new FileOutputStream("export" + File.separator + this.users.size() + ".csv", true);
outputDataFile.write("tick;x;y;user;bandwidth;\n".getBytes());
} catch(IOException e) {
System.err.println("Cannot create the output file");
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
System.exit(1);
return;
}