file album = new file(albumPath);if (album.exists()) { Log.d(TAG,albumPath + " already exists.");} else { boolean bfile = album.mkdir();}
而且,我创建第二个文件夹“sdcard / DD”由相同的代码,但是,这次album.exists()返回true,这表示“dd”是等于“DD”.
任何人都知道为什么file.exists()不能检查文件夹名称的大小写?谢谢!
解决方法 虽然linux,因此也是AndroID,通常在文件名时是区分大小写的,通常在SD卡,记忆棒等上使用的FAT文件系统是不区分大小写的.因此,当它处理这些文件系统上的文件时,AndroID将不会区分这些情况.因此,如果您有两个文件,/ sdcard / file(SD卡)和/ data / file(在内部文件系统上),您将得到以下结果:
new file("/sdcard/file").exists(); // truenew file("/sdcard/file").exists(); // true,/sdcard is a case-insensitive file systemnew file("/data/file").exists(); // truenew file("/data/file").exists(); // false,/data is a case-sensitive file system总结
以上是内存溢出为你收集整理的不是Android File.exists()区分大小写?全部内容,希望文章能够帮你解决不是Android File.exists()区分大小写?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)