diff --git a/console/src/main/kotlin/notes/multi/console/Console.kt b/console/src/main/kotlin/notes/multi/console/Console.kt index d5b30e4b077859210e607ae98b608d45fe7b4393..647d1178b19daebe105acb5b7707e80039ff778a 100644 --- a/console/src/main/kotlin/notes/multi/console/Console.kt +++ b/console/src/main/kotlin/notes/multi/console/Console.kt @@ -10,4 +10,5 @@ fun main() { val f = Filemanager("${System.getProperty("user.dir")}/test/", "hello.txt") f.writefile("hello world") println(f.openfile()) + f.deletefile() } diff --git a/console/test/hello.txt b/console/test/hello.txt deleted file mode 100644 index 95d09f2b10159347eece71399a7e2e907ea3df4f..0000000000000000000000000000000000000000 --- a/console/test/hello.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/utilities/src/main/kotlin/notes/multi/utilities/Filemanager.kt b/utilities/src/main/kotlin/notes/multi/utilities/Filemanager.kt index e4e934b99dfe665f00c31aef6033b222dc65e885..0f0e3bd365cc4f7645a5a07e41d15fd78371f4e5 100644 --- a/utilities/src/main/kotlin/notes/multi/utilities/Filemanager.kt +++ b/utilities/src/main/kotlin/notes/multi/utilities/Filemanager.kt @@ -24,6 +24,7 @@ class Filemanager(private val dir: String, private val name: String) { // create and write to that file fun writefile(line:String) { filepath.writeText(line) + listfiles.add(filepath) } // opens and read the existing file @@ -37,6 +38,7 @@ class Filemanager(private val dir: String, private val name: String) { } fun deletefile():Boolean { + listfiles.remove(filepath) return filepath.delete() }