The Android file store is not sensitive to file name capitalization

Source: Internet
Author: User

1, the development found that when two filenames only the case of the difference, the other is the same situation, Android will default to the same file.

For example, if you have a file under the same folder Aa.txt re-create a file named AA.txt Android will think that these two are the same file, thus appearing to overwrite the issue.

The test found that the windows, Mac OSX system is the same.

2. The problems encountered in the project are. Prevent overwriting problems caused by duplicate file names when creating documents. Using the File.exist () method to determine whether a file exists, the test finds that:

When the SD card is stored on a path, the method is case-insensitive, but when the path is in the data/directory, the method is casing-sensitive. However, the method is case-sensitive, the file name system that is actually stored in the data/directory is not case-sensitive, so when the file path is data/, you cannot use this method to determine whether the file exists.

If you have two files,/sdcard/file (on SD card) and/data/File (inside the filesystem), you get the following results:NewFile ("/sdcard/file"). exists ();//trueNewFile ("/sdcard/file"). exists ();//true,/sdcard is a case-insensitive file systemNewFile ("/data/file"). exists ();//trueNewFile ("/data/file"). exists ();//false,/data is case-sensitive file system

The Android file store is not sensitive to file name capitalization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.