From 97bdda71ce2bd99ebd24843f05ae1f6ce6aaeb11 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 24 Mar 2023 09:05:44 +0100 Subject: [PATCH] Change export directory --- .gitignore | 2 +- src/main/java/fr/ntr/AccessPoint.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index fdda839..8fac6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ build bin/ .idea .project -data.csv +export .vscode \ No newline at end of file diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index cca0bd4..c8955c7 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -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"); + } catch(IOException e) { + System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage()); System.exit(1); return; }