Skip to content

Commit

Permalink
Update absolute check
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Oct 30, 2017
1 parent 8ec994b commit b560331
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/billthefarmer/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public boolean onPrepareOptionsMenu (Menu menu)
String name =
path.replaceFirst(Environment
.getExternalStorageDirectory()
.getPath() + "/", "");
.getPath() + File.separator, "");
sub.add(name);
}

Expand Down Expand Up @@ -641,7 +641,7 @@ private void saveAs()
String name =
path.replaceFirst(Environment
.getExternalStorageDirectory()
.getPath() + "/", "");
.getPath() + File.separator, "");

// Open dialog
saveAsDialog(R.string.saveAs, R.string.choose, name,
Expand All @@ -655,13 +655,13 @@ public void onClick(DialogInterface dialog, int id)
EditText text =
(EditText) ((Dialog) dialog).findViewById(TEXT);
String name = text.getText().toString();
file = new File(name);

if (name.startsWith("/"))
file = new File(name);
else
// Check absolute file
if (!file.isAbsolute())
file = new
File(Environment.getExternalStorageDirectory(),
"/" + name);
File(Environment.getExternalStorageDirectory(),
File.separator + name);

path = file.getPath();
saveFile();
Expand Down

0 comments on commit b560331

Please sign in to comment.