2 // NSFileManager+UniqueNames.h
5 // Created by Joe Wreschnig on 3/7/13.
9 #import <Foundation/Foundation.h>
11 @interface
NSFileManager (UniqueNames
)
13 - (NSURL
*)generateUniqueURLWithBase
:(NSURL
*)canonical
;
14 // Generate a probably-unique URL by trying sequential indices, e.g.
16 // file://Test (1).txt
17 // file://Test (2).txt
20 // The URL is only probably unique. It is subject to the usual
21 // race conditions associated with generating a filename before
22 // actually opening it. It also does not check remote resources,
23 // as it operates synchronously. Finally, it gives up after 10,000