forked from Anuken/Arc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.java
More file actions
33 lines (26 loc) · 950 Bytes
/
Settings.java
File metadata and controls
33 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package arc;
import arc.files.*;
import arc.util.*;
public class Settings extends JsonSettings{
protected Fi dataDirectory;
public String appName = "app";
public Settings() {
// No auto save, the app must do it manually
super(Core.files.external(".stub"), false);
}
public Fi file(){
return getDataDirectory().child("settings." + (plainJson ? "json" : "bin"));
}
public Fi backupFile(){
return getDataDirectory().child("settings_backup." + (plainJson ? "json" : "bin"));
}
/** Returns the directory where all settings and data is placed. */
public Fi getDataDirectory(){
return dataDirectory != null ? dataDirectory :
Core.files.absolute(OS.getAppDataDirectoryString(appName));
}
/** Sets the settings file where everything is written to. */
public void setDataDirectory(Fi file){
this.dataDirectory = file;
}
}