Skip to content

Commit

Permalink
Entering a forward slash in custom file name will result in additiona…
Browse files Browse the repository at this point in the history
…l directories being created.

Issue #1085
  • Loading branch information
mendhak committed Jul 7, 2023
1 parent de3ead4 commit e25a7a5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public static List<FileLogger> getFileLoggers(Context context) {
gpxFolder.mkdirs();
}

// If a / exists in the user provided filename, create additional directories
if(Strings.getFormattedFileName().contains("/")){
File targetDirectory = new File(gpxFolder.getPath(), Strings.getFormattedFileName()).getParentFile();
if(!targetDirectory.exists()){
targetDirectory.mkdirs();
}
}

if (preferenceHelper.shouldLogToGpx()) {
File gpxFile = new File(gpxFolder.getPath(), Strings.getFormattedFileName() + ".gpx");
if(preferenceHelper.shouldLogAsGpx11()) {
Expand Down

0 comments on commit e25a7a5

Please sign in to comment.