home *** CD-ROM | disk | FTP | other *** search
- /*
-
- File filing.m
-
- The routines in this file fetch filenames using the application kit open and save panels.
-
- */
-
- #import <appkit/appkit.h>
- #import <strings.h>
-
- #import "filing.h"
-
-
- /* ———————————————————————————————————————————————————————————————————————————— */
-
-
- static char filename [200];
-
-
- /* ———————————————————————————————————————————————————————————————————————————— */
-
-
- const char * fileForOpen (types)
-
- char ** types;
-
- {
- const char * const * files;
- const char * directory;
- id panel;
-
- if ([panel = [OpenPanel new] runModalForTypes: types])
- {
- files = [panel filenames];
- directory = [panel directory];
- strcpy(filename, directory);
- strcat(filename, "/");
- strcat(filename, files[0]);
-
- return filename;
- }
-
- else return NULL;
- }
-
-
- const char * fileForSave (type)
-
- char * type;
-
- {
- id panel;
-
- panel = [[SavePanel new] setRequiredFileType: type];
- if ([panel runModal] == YES)
-
- return [panel filename]; else
- return NULL;
- }