Skip to content

Commit e126d85

Browse files
committed
Added a method that checks if the file exists.
1 parent 21c6b9c commit e126d85

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/main/java/net/mindustry_ddns/filestore/FileStore.java

+5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ static <T> FileStore<T> of(String path, Serializer<T> serializer) {
8080
*/
8181
void setFile(File file);
8282

83+
/**
84+
* @return If the file exists.
85+
*/
86+
boolean doesFileExist();
87+
8388
/**
8489
* Set the file where the object is stored.
8590
*

src/main/java/net/mindustry_ddns/filestore/SimpleFileStore.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.leangen.geantyref.TypeToken;
44
import net.mindustry_ddns.filestore.serial.Serializer;
5-
65
import java.io.*;
76
import java.nio.charset.StandardCharsets;
87

@@ -30,6 +29,11 @@ public void setFile(File file) {
3029
this.file = file;
3130
}
3231

32+
@Override
33+
public boolean doesFileExist() {
34+
return file.exists();
35+
}
36+
3337
@Override
3438
public T get() {
3539
return object;

0 commit comments

Comments
 (0)