Hi,I used something pretty much identical in a program of mine, but quickly realized that, although it worked, it wasn't scalable enough -- it made me feel a little uneasy. For instance, if you are saving a file over a slow network, it'll have to check each file's existence every time -- but it could take significantly longer for each file in such a case. I'm not sure what would be best, frankly. I hope that someone else will chime in with a built-in solution!
Best, Andrew On Nov 23, 2008, at 10:49 AM, Jean-Nicolas Jolivet wrote:
mmm I guess I'm a little slow today hehe... something like this would probably work (pseudo-code): cnt = 1 filename = "Picture " + cnt while(file exist (filename)) cnt ++ On 23-Nov-08, at 1:45 PM, Jean-Nicolas Jolivet wrote:I would love to implement something like the default screenshot utility for OS X does when it names its pictures.. (i.e. Picture 1, Picture 2, Picture 3.. etc.)I was wondering if there's already something in place to do that? If not, I don't mind implementing it myself but I can't really think of a simple way to do it? Counting the files in a directory is not really a reliable way to do it (i.e. if you have Picture 2 and Picture 3 in a directory, your count is 2... try naming your new picture Picture 3 and it overwrites the existing Picture 3 ...)I'm fairly good with RegEx so it would be easy to parse filenames for numbers I guess but it seems a little overkill for such a trivial task... (especially since my app wouldn't use Regex for anything else so, I dont want to add a regex framework just for that)...Any ideas would be appreciated? Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/silvertab%40videotron.ca This email sent to [EMAIL PROTECTED]Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu This email sent to [EMAIL PROTECTED]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]