mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Setting preferences.txt permissions to 600 on linux and mac
This commit is contained in:
@ -19,7 +19,7 @@ import processing.app.legacy.PConstants;
|
||||
|
||||
public class PreferencesData {
|
||||
|
||||
static final String PREFS_FILE = "preferences.txt";
|
||||
private static final String PREFS_FILE = "preferences.txt";
|
||||
|
||||
// data model
|
||||
|
||||
@ -30,18 +30,25 @@ public class PreferencesData {
|
||||
|
||||
|
||||
static public void init(File file) {
|
||||
if (file != null)
|
||||
if (file != null) {
|
||||
preferencesFile = file;
|
||||
else
|
||||
} else {
|
||||
preferencesFile = BaseNoGui.getSettingsFile(PREFS_FILE);
|
||||
}
|
||||
|
||||
try {
|
||||
BaseNoGui.getPlatform().fixPrefsFilePermissions(preferencesFile);
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
// start by loading the defaults, in case something
|
||||
// important was deleted from the user prefs
|
||||
try {
|
||||
prefs.load(BaseNoGui.getLibStream("preferences.txt"));
|
||||
prefs.load(BaseNoGui.getLibStream(PREFS_FILE));
|
||||
} catch (IOException e) {
|
||||
BaseNoGui.showError(null, _("Could not read default settings.\n" +
|
||||
"You'll need to reinstall Arduino."), e);
|
||||
"You'll need to reinstall Arduino."), e);
|
||||
}
|
||||
|
||||
// set some runtime constants (not saved on preferences file)
|
||||
@ -144,6 +151,12 @@ public class PreferencesData {
|
||||
|
||||
writer.flush();
|
||||
writer.close();
|
||||
|
||||
try {
|
||||
BaseNoGui.getPlatform().fixPrefsFilePermissions(preferencesFile);
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user