FROM : Andrew Merenbach
DATE : Sun Nov 11 16:43:07 2007
Hi, all,
I am working on a program that creates a standard preferences plist, a
subdirectory under Application Support, and a folder for auxiliary
data that is downloaded (this last one is placed at the top level of
the user's home directory). I had a couple of questions:
1. It valid to set up a menu item, for user convenience, to "reset"
the program and move any or all of these to the Trash? I get the
feeling that the answer is No on the first two items, but I'm not sure
about the last one. If the answer to these are "yes, if the files/
directories are in such-and-such a location," then what sort of
location would be valid?
2. I have tried to remove a subdirectory of the auxiliary-downloads
directory -- this subdirectory being named ".incoming" (with a period
at the beginning) -- using the following method, but I get an error.
Is this an example of sandboxing (about which I know very little), and
if so, what are my options (assuming that I should)? Note that this
method worked perfectly, as far as I can figure, on Tiger. (I just
recently updated to Leopard and have changed nothing in the following
method.)
+ (BOOL)deleteFileAtPath:(NSString *)path {
BOOL success = NO;
// Moves 'path' to the trash, a la NSWorkspace.
if ([[[self class] sharedWorkspace]
performFileOperation:NSWorkspaceRecycleOperation
source:[path stringByDeletingLastPathComponent]
destination:@""
files:[NSArray arrayWithObject:[path lastPathComponent]]
tag:0])
{
success = YES;
}
return success;
}
Cheers,
Andrew
DATE : Sun Nov 11 16:43:07 2007
Hi, all,
I am working on a program that creates a standard preferences plist, a
subdirectory under Application Support, and a folder for auxiliary
data that is downloaded (this last one is placed at the top level of
the user's home directory). I had a couple of questions:
1. It valid to set up a menu item, for user convenience, to "reset"
the program and move any or all of these to the Trash? I get the
feeling that the answer is No on the first two items, but I'm not sure
about the last one. If the answer to these are "yes, if the files/
directories are in such-and-such a location," then what sort of
location would be valid?
2. I have tried to remove a subdirectory of the auxiliary-downloads
directory -- this subdirectory being named ".incoming" (with a period
at the beginning) -- using the following method, but I get an error.
Is this an example of sandboxing (about which I know very little), and
if so, what are my options (assuming that I should)? Note that this
method worked perfectly, as far as I can figure, on Tiger. (I just
recently updated to Leopard and have changed nothing in the following
method.)
+ (BOOL)deleteFileAtPath:(NSString *)path {
BOOL success = NO;
// Moves 'path' to the trash, a la NSWorkspace.
if ([[[self class] sharedWorkspace]
performFileOperation:NSWorkspaceRecycleOperation
source:[path stringByDeletingLastPathComponent]
destination:@""
files:[NSArray arrayWithObject:[path lastPathComponent]]
tag:0])
{
success = YES;
}
return success;
}
Cheers,
Andrew
| Related mails | Author | Date |
|---|---|---|
| Andrew Merenbach | Nov 11, 16:43 | |
| Raffael Cavallaro | Nov 11, 17:49 | |
| Andrew Merenbach | Nov 11, 17:54 |






Cocoa mail archive

