How Do We Get The File Separators Used By The Different File Systems?
Solution 1:
From what I understand, Android has (at least) 2 file systems. One is for "internal" storage (e.g. /data and /system) and the other for "external" storage (e.g. /mnt/sdcard),
That was accurate for Android 1.x and 2.x. As of Android 3.0, external storage is merely a directory inside of internal storage.
This implies that when we save files to "internal" storage (Context.getFilesDir, Context.getCacheDir), the file separator used may be different from when we save files to "external" storage
Of course not. Separators are a feature of an operating system, not a file system.
Is there anyway to get a list of filesystems on Android?
Nothing that is supported. SDK applications should only use internal and external storage, such as via the APIs you cited in your answer.
Hmm, I've heard of mountaing the external drive on a NTFS which is why I think that they can be different
You are mistaken. File and path separators have nothing to do with the format of the file system.
However its not just the file separators, the file delimiters (path separators) are also different between different file systems.
You are mistaken. File and path separators have nothing to do with the format of the file system.
Solution 2:
If you're concerned about putting a hardcoded file separator in your code you can use File.separator in place of hardcoded "/". This will give you the file separator used by Android without having concern of whatever file system lies underneath
Post a Comment for "How Do We Get The File Separators Used By The Different File Systems?"