@Test public void testtoRelativePath() { File base = new File("/data/media/0"); File file = new File("/data/media/0/Music/somefile.mp3"); assertThat(toRelativePath(base, file)).isEqualTo("Music/somefile.mp3"); assertThat(file).isEqualTo(new File(base, toRelativePath(base, file))); }
public static @NonNull String toRelativePath(File base, File f) { String p = StringUtils.replace(f.getAbsolutePath(), base.getAbsolutePath(), "", 1); return !p.startsWith("/") ? p : p.substring(1); }
FilesHelper { public static @NonNull String toRelativePath(File base, File f) { String p = StringUtils.replace(f.getAbsolutePath(), base.getAbsolutePath(), "", 1); return !p.startsWith("/") ? p : p.substring(1); } }
FilesHelper { public static @NonNull String toRelativePath(File base, File f) { String p = StringUtils.replace(f.getAbsolutePath(), base.getAbsolutePath(), "", 1); return !p.startsWith("/") ? p : p.substring(1); }  }
FilesHelper { public static @NonNull String toRelativePath(File base, File f) { String p = StringUtils.replace(f.getAbsolutePath(), base.getAbsolutePath(), "", 1); return !p.startsWith("/") ? p : p.substring(1); }  static String getFileExtension(String name); static String getFileExtension(File f); static String guessMimeType(File f); static String guessMimeType(String ext); static @NonNull String formatDate(long ms); static @NonNull String toRelativePath(File base, File f); static String toRelativePath(String base, File f); static @NonNull Folder makeRoot(String authority, StorageVolume volume); static @NonNull Folder makeFolder(String authority, StorageVolume volume, File dir); static @NonNull Track makeTrackFromFile(String authority, StorageVolume volume, File f); static long getFlags(@NonNull File f); static boolean deleteFile(File base, String relPath); static int deleteTrack(final Context context, final String id); static boolean deleteDirectory(Context context, File dir); static @NonNull List<File> filterAudioFiles(Context context, List<File> files); static @NonNull List<Track> convertAudioFilesToTracks(
            Context context, String authority, StorageVolume volume, List<File> audioFiles); static Track findTrack(Context context, String authority, StorageVolume volume, String id); static Track.Builder makeTrackFromCursor(String authority, StorageVolume volume, File f, Cursor c); static StorageVolume guessStorageVolume(Context context, List<StorageLookup.StorageVolume> volumes, String path); static void closeQuietly(Cursor c); }
FilesHelper { public static @NonNull String toRelativePath(File base, File f) { String p = StringUtils.replace(f.getAbsolutePath(), base.getAbsolutePath(), "", 1); return !p.startsWith("/") ? p : p.substring(1); }  static String getFileExtension(String name); static String getFileExtension(File f); static String guessMimeType(File f); static String guessMimeType(String ext); static @NonNull String formatDate(long ms); static @NonNull String toRelativePath(File base, File f); static String toRelativePath(String base, File f); static @NonNull Folder makeRoot(String authority, StorageVolume volume); static @NonNull Folder makeFolder(String authority, StorageVolume volume, File dir); static @NonNull Track makeTrackFromFile(String authority, StorageVolume volume, File f); static long getFlags(@NonNull File f); static boolean deleteFile(File base, String relPath); static int deleteTrack(final Context context, final String id); static boolean deleteDirectory(Context context, File dir); static @NonNull List<File> filterAudioFiles(Context context, List<File> files); static @NonNull List<Track> convertAudioFilesToTracks(
            Context context, String authority, StorageVolume volume, List<File> audioFiles); static Track findTrack(Context context, String authority, StorageVolume volume, String id); static Track.Builder makeTrackFromCursor(String authority, StorageVolume volume, File f, Cursor c); static StorageVolume guessStorageVolume(Context context, List<StorageLookup.StorageVolume> volumes, String path); static void closeQuietly(Cursor c); static final boolean DUMPSTACKS; }