Commit bf043908 authored by Roumen Petrov's avatar Roumen Petrov

remove preferences that allows path "extensions".

Now allowed by default - as from version 2.7.0 "path" permission protection level is "signature".

Note obsolete string resources will be removed in next major version.
parent b99c4ce6
......@@ -48,14 +48,33 @@
public void onCreate() {
super.onCreate();
setupPreferences();
ThemeManager.migrateFileSelectionThemeMode(this);
}
private void setupPreferences() {
boolean updated = false;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = prefs.edit();
if (!prefs.contains("home_path")) {
SharedPreferences.Editor editor = prefs.edit();
String path = getDir("HOME", MODE_PRIVATE).getAbsolutePath();
editor.putString("home_path", path);
editor.apply();
updated = true;
}
// remove obsolete preferences:
// - after v3.0.0, TODO remove string resources in next major
if (prefs.contains("allow_prepend_path")) {
// Note depends from do_path_extensions
editor.remove("allow_prepend_path");
updated = true;
}
if (prefs.contains("do_path_extensions")) {
editor.remove("do_path_extensions");
updated = true;
}
ThemeManager.migrateFileSelectionThemeMode(this);
if (updated) editor.apply();
}
}
......@@ -35,14 +35,10 @@
private String mAppendPath = null;
// extracted from SharedPreferences
private boolean path_extend;
private boolean path_prepend;
private boolean path_verify;
private PathSettings(Resources res) {
path_extend = res.getBoolean(R.bool.pref_do_path_extensions_default);
path_prepend = res.getBoolean(R.bool.pref_allow_prepend_path_default);
path_verify = res.getBoolean(R.bool.pref_verify_path_default);
}
......@@ -52,8 +48,6 @@ public PathSettings(Resources res, SharedPreferences prefs) {
}
public void extractPreferences(SharedPreferences prefs) {
path_extend = prefs.getBoolean("do_path_extensions", path_extend);
path_prepend = prefs.getBoolean("allow_prepend_path", path_prepend);
path_verify = prefs.getBoolean("verify_path", path_verify);
}
......@@ -75,10 +69,8 @@ public void setAppendPath(String appendPath) {
public String buildPATH() {
String path = System.getenv("PATH");
if (path == null)
path = "";
if (path_extend)
path = extendPath(path);
if (path == null) path = "";
path = extendPath(path);
if (path_verify)
path = preservePath(path);
return path;
......@@ -91,8 +83,6 @@ private String extendPath(String path) {
if (!TextUtils.isEmpty(s))
path = path + ":" + s;
if (!path_prepend) return path;
s = getPrependPath();
if (!TextUtils.isEmpty(s))
path = s + ":" + path;
......
......@@ -21,8 +21,6 @@
<string name="pref_termtype_default" translatable="false">screen</string>
<bool name="pref_close_window_on_process_exit_default">true</bool>
<bool name="pref_verify_path_default">true</bool>
<bool name="pref_do_path_extensions_default">true</bool>
<bool name="pref_allow_prepend_path_default">true</bool>
<!-- the home_path default is set dynamically in Term.onResume() -->
<bool name="pref_mouse_tracking_default">false</bool>
<bool name="pref_use_keyboard_shortcuts_default">true</bool>
......
......@@ -226,19 +226,6 @@
android:summary="@string/summary_verify_path_preference"
android:title="@string/title_verify_path_preference"/>
<CheckBoxPreference
android:defaultValue="@bool/pref_do_path_extensions_default"
android:key="do_path_extensions"
android:summary="@string/summary_do_path_extensions_preference"
android:title="@string/title_do_path_extensions_preference"/>
<CheckBoxPreference
android:defaultValue="@bool/pref_allow_prepend_path_default"
android:dependency="do_path_extensions"
android:key="allow_prepend_path"
android:summary="@string/summary_allow_prepend_path_preference"
android:title="@string/title_allow_prepend_path_preference"/>
</PreferenceCategory>
</PreferenceScreen>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment