diff options
author | Emanuele Grasso <96300448+L0P0P@users.noreply.github.com> | 2024-07-14 18:48:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-14 18:48:09 +0200 |
commit | ce49d20a5fe3726e1800bc495a25c7617212abf4 (patch) | |
tree | 5a1a79efa79e7bf6dcf3d3151aec2edf6a47b3e7 /src/semanticanalysis/Share.java | |
parent | 57599a42b863cc48050c137de2ec108aa1d59a44 (diff) |
Reaching definition analysis (#17)
Co-authored-by: Santo Cariotti <santo@dcariotti.me>
Co-authored-by: geno <gabriele.genovese2@studio.unibo.it>
Co-authored-by: geno <gabrigeno@gmail.com>
Diffstat (limited to 'src/semanticanalysis/Share.java')
-rw-r--r-- | src/semanticanalysis/Share.java | 16 |
1 files changed, 16 insertions, 0 deletions
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(); + } + } } |