Returns a pathname for a file that does not currently exist. The pathname will be directory/base_name.extension or directory/base_name_ .extension if directory/base_name.extension already exists. The number will be incremented until a pathname is found that does not already exist. Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. There could be a race condition if two or more processes
| 7704 | // There could be a race condition if two or more processes are calling this |
| 7705 | // function at the same time -- they could both pick the same filename. |
| 7706 | FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, |
| 7707 | const FilePath& base_name, |
| 7708 | const char* extension) { |
| 7709 | FilePath full_pathname; |
| 7710 | int number = 0; |
| 7711 | do { |
| 7712 | full_pathname.Set(MakeFileName(directory, base_name, number++, extension)); |
| 7713 | } while (full_pathname.FileOrDirectoryExists()); |
| 7714 | return full_pathname; |
| 7715 | } |
| 7716 | |
| 7717 | // Returns true if FilePath ends with a path separator, which indicates that |
| 7718 | // it is intended to represent a directory. Returns false otherwise. |
nothing calls this directly
no test coverage detected