forked from upstream-mirrors/OpenTracks
Prepend MyTracks to photo folder
This commit is contained in:
+3
-6
@@ -183,7 +183,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
// Delete tracks last since it triggers a database vaccum call
|
||||
contentResolver.delete(TracksColumns.CONTENT_URI, null, null);
|
||||
|
||||
File dir = new File(FileUtils.getPath(FileUtils.PICTURES_DIR));
|
||||
File dir = FileUtils.getPhotoDir();
|
||||
deleteDirectoryRecurse(dir);
|
||||
}
|
||||
|
||||
@@ -212,11 +212,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
contentResolver.delete(TrackPointsColumns.CONTENT_URI, where, selectionArgs);
|
||||
}
|
||||
contentResolver.delete(WaypointsColumns.CONTENT_URI, WaypointsColumns.TRACKID + "=?",
|
||||
new String[] { Long.toString(trackId) });
|
||||
|
||||
File dir = new File(
|
||||
FileUtils.getPath(FileUtils.PICTURES_DIR, Long.toString(trackId)));
|
||||
deleteDirectoryRecurse(dir);
|
||||
new String[] { Long.toString(trackId) });
|
||||
deleteDirectoryRecurse(FileUtils.getPhotoDir(trackId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,11 +33,6 @@ public class FileUtils {
|
||||
*/
|
||||
public static final String BACKUPS_DIR = "backups";
|
||||
|
||||
/**
|
||||
* The pictures directory under the My Tracks external storage directory.
|
||||
*/
|
||||
public static final String PICTURES_DIR = "pictures";
|
||||
|
||||
/**
|
||||
* The My Tracks external storage directory.
|
||||
*/
|
||||
@@ -53,12 +48,17 @@ public class FileUtils {
|
||||
* The play tracks directory under the My Tracks cache directory.
|
||||
*/
|
||||
public static final String PLAY_TRACKS_DIR = "temp";
|
||||
|
||||
|
||||
/**
|
||||
* The temp files directory under the My Tracks cache directory.
|
||||
*/
|
||||
public static final String TEMP_FILES_DIR = "temp_files";
|
||||
|
||||
public static final String TEMP_FILES_DIR = "temp_files";
|
||||
|
||||
/**
|
||||
* The pictures directory under the My Tracks external storage directory.
|
||||
*/
|
||||
private static final String PICTURES_DIR = "pictures";
|
||||
|
||||
/**
|
||||
* Returns true if the external storage is available.
|
||||
*/
|
||||
@@ -98,6 +98,14 @@ public class FileUtils {
|
||||
return dir.mkdirs();
|
||||
}
|
||||
|
||||
public static File getPhotoDir() {
|
||||
return new File(getPath(PICTURES_DIR));
|
||||
}
|
||||
|
||||
public static File getPhotoDir(long trackId) {
|
||||
return new File(getPath(PICTURES_DIR, "MyTracks" + Long.toString(trackId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display name for a path on the external storage.
|
||||
*
|
||||
@@ -150,9 +158,9 @@ public class FileUtils {
|
||||
if (index == -1) {
|
||||
return fileName;
|
||||
}
|
||||
return fileName.substring(0, index);
|
||||
return fileName.substring(0, index);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the extension from a file name. Returns null if there is no extension.
|
||||
*
|
||||
@@ -164,8 +172,8 @@ public class FileUtils {
|
||||
return null;
|
||||
}
|
||||
return fileName.substring(index + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a filename with the given base and the given extension, possibly
|
||||
* adding a suffix to ensure the file doesn't exist.
|
||||
|
||||
Reference in New Issue
Block a user