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
| 9514 | // There could be a race condition if two or more processes are calling this |
| 9515 | // function at the same time -- they could both pick the same filename. |
| 9516 | FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, |
| 9517 | const FilePath& base_name, |
| 9518 | const char* extension) { |
| 9519 | FilePath full_pathname; |
| 9520 | int number = 0; |
| 9521 | do { |
| 9522 | full_pathname.Set(MakeFileName(directory, base_name, number++, extension)); |
| 9523 | } while (full_pathname.FileOrDirectoryExists()); |
| 9524 | return full_pathname; |
| 9525 | } |
| 9526 | |
| 9527 | // Returns true if FilePath ends with a path separator, which indicates that |
| 9528 | // it is intended to represent a directory. Returns false otherwise. |
nothing calls this directly
no test coverage detected