diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java index fb1badf2aa..40877bf8dc 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java @@ -76,6 +76,8 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial sourceFileName = savedInstanceState.getString(SOURCE_FILE_NAME_KEY); sourceFolderName = savedInstanceState.getString(SOURCE_FOLDER_NAME_KEY); showSimplifiedButton = savedInstanceState.getBoolean(SHOW_SIMPLIFIED_BUTTON_KEY); + } else { + folderName = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getName(); } items.add(new TitleItem(getString(R.string.save_as_new_track))); @@ -290,7 +292,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial private File getFile(OsmandApplication app, String folderName, String fileName) { File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); File source = dir; - if (folderName != null) { + if (folderName != null && !dir.getName().equals(folderName)) { source = new File(dir, folderName); } source = new File(source, fileName + IndexConstants.GPX_FILE_EXT); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java index b207d7aac5..b383a4bef6 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/adapter/FolderListAdapter.java @@ -48,7 +48,8 @@ public class FolderListAdapter extends RecyclerView.Adapter getFolders() { List dirs = new ArrayList<>(); - final File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); + File gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); + dirs.add(gpxDir); Algorithms.collectDirs(gpxDir, dirs); List dirItems = new ArrayList<>(); for (File dir : dirs) { diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java index b7b87f01b2..0f804013ca 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java @@ -894,7 +894,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe public void onSaveAsNewTrack(String folderName, String fileName, boolean showOnMap, boolean simplifiedTrack) { OsmandApplication app = getMyApplication(); if (app != null) { - File fileDir = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), folderName == null ? "" : folderName); + File fileDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); + if (!fileDir.getName().equals(folderName)) { + fileDir = new File(fileDir, folderName); + } File toSave = new File(fileDir, fileName + GPX_FILE_EXT); new SaveDirectionsAsyncTask(app, showOnMap).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave); }