From ce49d20a5fe3726e1800bc495a25c7617212abf4 Mon Sep 17 00:00:00 2001 From: Emanuele Grasso <96300448+L0P0P@users.noreply.github.com> Date: Sun, 14 Jul 2024 18:48:09 +0200 Subject: Reaching definition analysis (#17) Co-authored-by: Santo Cariotti Co-authored-by: geno Co-authored-by: geno --- src/semanticanalysis/Share.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/semanticanalysis/Share.java') diff --git a/src/semanticanalysis/Share.java b/src/semanticanalysis/Share.java index a05c4c5..5bb8099 100644 --- a/src/semanticanalysis/Share.java +++ b/src/semanticanalysis/Share.java @@ -1,6 +1,10 @@ package semanticanalysis; import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.*; public class Share { @@ -55,4 +59,16 @@ public class Share { } return content.toString(); } + + public static void saveFile(String fileName, String content) { + try { + Path file = Paths.get(fileName); + if (!Files.exists(file)) { + Files.createFile(file); + } + Files.write(file, content.getBytes(), StandardOpenOption.TRUNCATE_EXISTING); + } catch (Exception e) { + e.printStackTrace(); + } + } } -- cgit v1.2.3-18-g5258