OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 25
Line 20... Line 20...
20
import java.io.BufferedInputStream;
20
import java.io.BufferedInputStream;
21
import java.io.BufferedOutputStream;
21
import java.io.BufferedOutputStream;
22
import java.io.File;
22
import java.io.File;
23
import java.io.FileInputStream;
23
import java.io.FileInputStream;
24
import java.io.FileOutputStream;
24
import java.io.FileOutputStream;
-
 
25
import java.io.IOException;
25
import java.util.Properties;
26
import java.util.Properties;
26
 
27
 
27
public class DefaultLocalPreferencePanel extends DefaultPreferencePanel {
28
public class DefaultLocalPreferencePanel extends DefaultPreferencePanel {
28
    private final String title, fileName;
29
    private final String title, fileName;
29
    protected final Properties properties = new Properties();
30
    protected final Properties properties = new Properties();
Line 69... Line 70...
69
    }
70
    }
70
 
71
 
71
    public static File getPrefFile(String fileName) {
72
    public static File getPrefFile(String fileName) {
72
        return new File(Configuration.getInstance().getConfDir(), "/Configuration/" + fileName);
73
        return new File(Configuration.getInstance().getConfDir(), "/Configuration/" + fileName);
73
    }
74
    }
-
 
75
 
-
 
76
    public static Properties getPropertiesFromFile(String fileName) throws IOException {
-
 
77
        final Properties properties = new Properties();
-
 
78
        if (getPrefFile(fileName).exists()) {
-
 
79
            FileInputStream fIp = new FileInputStream(getPrefFile(fileName));
-
 
80
            properties.load(new BufferedInputStream(fIp));
-
 
81
            fIp.close();
-
 
82
        }
-
 
83
        return properties;
-
 
84
    }
74
}
85
}