Currently, base::GetUniquePathNumber() takes a nullable argument called "suffix", but nobody is using it. Furthermore, if one were to use it, one would run into confusing behavior. GetUniquePathNumber() is supposed to find a number to append to the filename in order to get an unused filename. However, it assumes that the user would always, given filename "x", would use number n to construct a new filename of the form "x (n)". This is not mentioned in the function's documentation; one must read the implementation to discern this detail.
Suppose "foo/bar" exists in the system. One calls GetUniquePathNumber("foo/bar", "_") and gets 1. One would then create the file "foo/bar_1". However, next time GetUniquePathNumber("foo/bar", "_") is called, 1 will be returned again, because GetUniquePathNumber() was actually checking for the existence of "foor/bar (1)" and "foo/bar (1)_", which is contrary to one would expect.
Comment 1 by eladalon@chromium.org
, Nov 16 2017