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/ bin/
.idea .idea
.project .project
data.csv export
.vscode .vscode

View File

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