mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-02 01:01:17 +00:00
FileUtils: Move getExternalStorageDownloadsDirectory code into separate function
This commit is contained in:
parent
cc76014207
commit
4ef5853b88
1 changed files with 8 additions and 2 deletions
|
@ -115,8 +115,7 @@ public class FileUtils {
|
||||||
}
|
}
|
||||||
if (DOWNLOADS_VOLUME_NAME.equals(volumeId)) {
|
if (DOWNLOADS_VOLUME_NAME.equals(volumeId)) {
|
||||||
Log.v(TAG, "getVolumePath: isDownloadsVolume");
|
Log.v(TAG, "getVolumePath: isDownloadsVolume");
|
||||||
// Reading the environment var avoids hard coding the case of the "downloads" folder.
|
return getExternalStorageDownloadsDirectory();
|
||||||
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageManager mStorageManager =
|
StorageManager mStorageManager =
|
||||||
|
@ -237,6 +236,13 @@ public class FileUtils {
|
||||||
else return File.separator;
|
else return File.separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reading the environment var avoids hard coding the absolute path of the "/Download" folder.
|
||||||
|
*/
|
||||||
|
public static String getExternalStorageDownloadsDirectory() {
|
||||||
|
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static String cutTrailingSlash(final String path) {
|
public static String cutTrailingSlash(final String path) {
|
||||||
if (path.endsWith(File.separator)) {
|
if (path.endsWith(File.separator)) {
|
||||||
|
|
Loading…
Reference in a new issue