diff --git a/src/main/java/org/billthefarmer/editor/Editor.java b/src/main/java/org/billthefarmer/editor/Editor.java index aee0e97..1c99ff2 100644 --- a/src/main/java/org/billthefarmer/editor/Editor.java +++ b/src/main/java/org/billthefarmer/editor/Editor.java @@ -407,7 +407,7 @@ public boolean onPrepareOptionsMenu (Menu menu) String name = path.replaceFirst(Environment .getExternalStorageDirectory() - .getPath() + "/", ""); + .getPath() + File.separator, ""); sub.add(name); } @@ -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, @@ -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();