[anOpenPanel filename] won't work after XCode 1.1 update
[anOpenPanel filename] won't work after XCode 1.1 update
- Subject: [anOpenPanel filename] won't work after XCode 1.1 update
- From: Fernando Santos <email@hidden>
- Date: Sun, 21 Dec 2003 22:52:46 -0200
Hey guys,
I'm writing an app that edits HTML and JavaScript files and it's got a
feature that creates projects with template files. It worked fine until
I updated to Mac OS 10.3.2 and XCode 1.1 yesterday.
Here is the code I've been working on: (I didn't have much time so I
added some comments to the code)
- (IBAction)criarProjeto:(id)sender
{
// Creates an Open Panel
NSOpenPanel *painelAbrir;
painelAbrir = [[NSOpenPanel alloc] init];
[painelAbrir setTitle:@"Escolha um Diretsrio"];
[painelAbrir setCanChooseDirectories:YES];
[painelAbrir setCanCreateDirectories:YES];
[painelAbrir setCanChooseFiles:NO];
// Alert - Checks if user pressed OK Button on the Open panel
if([painelAbrir runModalForTypes:nil] == NSOKButton)
{
NSString *path;
path = [painelAbrir filename]; // Here lies all my suffering
NSString *pathFinal;
pathFinal = [path stringByAppendingPathComponent:@"Projeto"];
// path and pathFinal strings won't return anything even outside the
"if"s
NSAlert *alerta = [[NSAlert alloc] init];
[alerta addButtonWithTitle:@"OK"];
[alerta addButtonWithTitle:@"Cancelar"];
[alerta setMessageText:@"Criar Projeto?"];
[alerta setInformativeText:@"O Projeto sera criado no diretsrio
escolhido. Deseja continuar?"];
[alerta setAlertStyle:NSWarningAlertStyle];
if ([alerta runModal] == NSOKButton) {
// OK
// Create the folder inside the path chosen by the user
[[NSFileManager defaultManager] createDirectoryAtPath:pathFinal
attributes:nil];
}
[alerta release];
}
}
This is not working properly. All the alerts show up and the open panel
works the way it should, except by the fact that [painelAbrir filename]
does not return anything.
Is there something wrong? And if there is, why did it work in XCode
1.0.1 ?
Thank you.
======================================
Fernando Lucas
Estudante
Programador
Designer Grafico
eMail : email@hidden
iModz :
http://www.macmagazine.com.br/imodz/
VisualSome:
http://nandolucas.deviantart.com/gallery/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.