Add share format hint and fix a bug. (#43)

The bug crashes the app if the providing share path is "\".

This fixes #16 and #22.
This commit is contained in:
Xu Tan 2017-09-21 14:42:33 -07:00 committed by GitHub
parent b1db7559d1
commit 1cf95a5b2d
2 changed files with 4 additions and 1 deletions

View file

@ -362,6 +362,9 @@ public class MountServerActivity extends AppCompatActivity {
final String path = mSharePathEditText.getText().toString();
if (path.startsWith("\\")) {
// Possibly Windows share path
if (path.length() == 1) {
return null;
}
final int endCharacter = path.endsWith("\\") ? path.length() - 1 : path.length();
final String[] components = path.substring(2, endCharacter).split("\\\\");
return components.length == 2 ? components : null;

View file

@ -18,7 +18,7 @@
<resources>
<string name="app_name">Android Samba Client</string>
<string name="share_path">Share Path</string>
<string name="share_path">Share Path e.g. smb://server/share</string>
<string name="domain">Domain</string>
<string name="username">Username</string>
<string name="password">Password</string>