home *** CD-ROM | disk | FTP | other *** search
- #include <utility/tagitem.h>
- #include <string.h>
- #include <proto/exec.h>
- #include <proto/asl.h>
- #include <proto/dos.h>
-
- extern void clearHeader( void );
- extern void updateGadgets( void );
- extern void newChunkList( void );
- extern char filename[], chunkname[];
- extern ULONG filesize;
-
-
- STRPTR msg_selectsource, msg_selectdest;
-
- static char drawer[95];
- static char name[33];
-
- struct TagItem sourcetags[] = {
- { ASLFR_TitleText, NULL },
- { ASLFR_InitialDrawer, (ULONG)drawer },
- { ASLFR_InitialFile, (ULONG)name },
- { ASLFR_InitialHeight, 210L },
- { ASLFR_RejectIcons, TRUE },
- { TAG_END, NULL } };
-
- struct Library *AslBase;
-
- static BOOL askFile( STRPTR dest )
- {
- struct FileRequester *request;
- BOOL result = FALSE;
-
- if ( AslBase = OpenLibrary( "asl.library", 0L ) )
- {
- if ( request = (struct FileRequester *)AllocAslRequest( ASL_FileRequest, sourcetags ) )
- {
- if ( AslRequest( request, sourcetags ) )
- {
- strcpy( drawer, request->fr_Drawer );
- strcpy( name, request->fr_File );
-
- strcpy( dest, request->fr_Drawer );
- if ( dest[0] )
- {
- strcpy( drawer, dest );
- if ( dest[ strlen(dest)-1 ] != ':' && dest[ strlen(dest)-1 ] != '/' )
- strcat( dest, "/" );
- }
- strcat( dest, FilePart(request->fr_File) );
- result = TRUE;
- }
- FreeAslRequest( request );
- }
- CloseLibrary( AslBase );
- }
- return result;
- }
-
-
- void askDest( void )
- {
- sourcetags[0].ti_Data = (ULONG)msg_selectdest;
- if ( askFile( chunkname ) )
- updateGadgets();
- }
-
-
- void askSource( void )
- {
- sourcetags[0].ti_Data = (ULONG)msg_selectsource;
- if ( askFile( filename ) )
- {
- BPTR lock;
- struct FileInfoBlock fib;
-
- if ( lock = Lock( filename, ACCESS_READ ) )
- {
- if ( Examine( lock, &fib ) )
- filesize = fib.fib_Size;
- else filesize = 0;
- UnLock( lock );
- }
- newChunkList();
- updateGadgets();
- }
- }
-