I might try some of the following:
1) use the NSGlobalDomain to store the counting data.
2) implement the functionality as a service (like grab does)
3) build a small helper application and let it do all the work.
4) implement the counting data in a single file (at so
Hi, Douglas,
That's not a bad idea, but would this not be a problem if the prefix
(e.g., "Picture") were shared by another program, such as the system's
screen-grabbing functionality? Also, if someone deliberately puts a
file on the Desktop and names it "Picture 5", it could get overwritte
Jean-Nicolas.
Have you considered the notion of keeping your "counting data" in the
user defaults? This would give you quick persistence, without having
to calculate a value using the contents of a directory. Each time
you create a new file, increment the counting data and re-store the
On Nov 23, 2008, at 2:33 PM, Nathan Kinsinger wrote:
On Nov 23, 2008, at 3:12 PM, Adam R. Maxwell wrote:
On Nov 23, 2008, at 2:02 PM, Nathan Kinsinger wrote:
It didn't find the file because you forgot to update the content
array after creating the new file.
Right, I rearranged things a bi
On Nov 23, 2008, at 3:12 PM, Adam R. Maxwell wrote:
On Nov 23, 2008, at 2:02 PM, Nathan Kinsinger wrote:
It didn't find the file because you forgot to update the content
array after creating the new file.
Right, I rearranged things a bit and forgot that. However, that
only matters if you
On Nov 23, 2008, at 2:02 PM, Nathan Kinsinger wrote:
It didn't find the file because you forgot to update the content
array after creating the new file.
Right, I rearranged things a bit and forgot that. However, that only
matters if you create "Test file" (which doesn't change the case of
On Nov 23, 2008, at 1:42 PM, Adam R. Maxwell wrote:
On Nov 23, 2008, at 11:56 AM, Kevin Gessner wrote:
Rather than hitting the file system every time you want to check
file existence, you could cache it from -[NSFileManager
directoryContentsAtPath:]. You could run in to a race condition (if
On Nov 23, 2008, at 11:56 AM, Kevin Gessner wrote:
Rather than hitting the file system every time you want to check
file existence, you could cache it from -[NSFileManager
directoryContentsAtPath:]. You could run in to a race condition (if
another process creates a file between when you ch
Hi!
Thank you for the code, Chaitanya. Unfortunately, unless I'm missing
something, I'm not sure that it'll work in my particular case, since I
want sequential numbering, rather than random numbering; in other
words, this isn't for a unique identifier of sorts, but rather to
indicate how
On Sun, Nov 23, 2008 at 12:55 PM, Andrew Merenbach
<[EMAIL PROTECTED]> wrote:
> 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
Rather than hitting the file system every time you want to check file
existence, you could cache it from -[NSFileManager
directoryContentsAtPath:]. You could run in to a race condition (if
another process creates a file between when you check the list and
when you write your file), but that
I'm not sure if you guys want the prefix to be "Picture" etc. but i
simply get a random number using rand(); and check if a file exists
with that name.
Heres a code snippet,
+ (NSString *)getUniqueNameForFile: (NSString *)aFilePath
{
// Initialise the return path
NSString *pa
You're right, hadn't thought of that! Well, I'll implement it like
that for now but I'll keep an eye on this thread, see if anyone has a
better idea! :)
On 23-Nov-08, at 1:55 PM, Andrew Merenbach wrote:
Hi,
I used something pretty much identical in a program of mine, but
quickly realize
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 -
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 screen
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 t
16 matches
Mail list logo