Commit 17005dc8 authored by Edward Wang's avatar Edward Wang

BrowserActivity: verify against adding invalid directories

parent bf845dfb
......@@ -86,6 +86,7 @@
<string name="mediafiles">Media files</string>
<string name="notavailable">not available</string>
<string name="nosubdirectory">No subdirectories.</string>
<string name="directorynotfound">The directory path \'%1$s\' was not found.</string>
<string name="nohistory">You have no playback history yet.</string>
<string name="validation">Are you sure?</string>
......
......@@ -51,6 +51,7 @@ import android.view.View;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
public class BrowserActivity extends ListActivity {
public final static String TAG = "VLC/BrowserActivity";
......@@ -192,7 +193,14 @@ public class BrowserActivity extends ListActivity {
b.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
CustomDirectories.addCustomDirectory(input.getText().toString());
String path = input.getText().toString().trim();
File f = new File(path);
if(!f.exists() || !f.isDirectory()) {
Toast.makeText(BrowserActivity.this, getString(R.string.directorynotfound, path), Toast.LENGTH_SHORT).show();
return;
}
CustomDirectories.addCustomDirectory(f.getAbsolutePath());
refresh();
}
});
......
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