annotate src/win32/7zip/OpenArchive.h @ 8:08a8e09ca414

add files required by automake
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:54:39 -0600
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 // for retrieving files from archives and/or managing temporary files
rlm@1 2
rlm@1 3 #ifndef OPENARCHIVE_HEADER
rlm@1 4 #define OPENARCHIVE_HEADER
rlm@1 5
rlm@1 6 #include "7zip.h"
rlm@1 7
rlm@1 8 // ObtainFile()
rlm@1 9 // this is the main, high-level function for opening possibly-compressed files.
rlm@1 10 // you don't need to check whether the file is compressed beforehand,
rlm@1 11 // this function will figure that out and work correctly either way.
rlm@1 12 // it also does the work of bringing up a within-archive file selector dialog if necessary,
rlm@1 13 // which even allows navigating to a file within an archive that's within the archive.
rlm@1 14 // the output PhysicalName is the filename of an uncompressed file
rlm@1 15 // for you to load with fopen or whatever,
rlm@1 16 // unless the function fails (or is cancelled) in which case it will return false.
rlm@1 17 // example input Name: "C:\games.zip"
rlm@1 18 // example output LogicalName: "C:\games.zip|Metroid.gba"
rlm@1 19 // example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\VBA\rom7A37.gba"
rlm@1 20 // assumes the three name arguments are distinct character buffers with exactly 2048 bytes each
rlm@1 21 bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category=NULL, const char** ignoreExtensions=NULL, int numIgnoreExtensions=0);
rlm@1 22
rlm@1 23 // ReleaseTempFileCategory()
rlm@1 24 // this is for deleting the temporary files that ObtainFile() can create.
rlm@1 25 // using it is optional because they will auto-delete on proper shutdown of the program,
rlm@1 26 // but it's nice to be able to clean up the files as early as possible.
rlm@1 27 // pass in the same "category" string you passed into ObtainFile(),
rlm@1 28 // and this will delete all files of that category.
rlm@1 29 // you can optionally specify one filename to not delete even if its category matches.
rlm@1 30 // note that any still-open files cannot be deleted yet and will be skipped.
rlm@1 31 void ReleaseTempFileCategory(const char* category, const char* exceptionFilename=NULL);
rlm@1 32
rlm@1 33 // sets the parent window of subsequent archive selector dialogs
rlm@1 34 // NULL resets this to the default (main VBA emulator window)
rlm@1 35 void SetArchiveParentHWND(void* hwnd=NULL);
rlm@1 36
rlm@1 37 // the rest of these are more internal utility functions,
rlm@1 38 // but they could be generally useful outside of that
rlm@1 39 const char* GetTempFile(const char* category=NULL, const char* extension=NULL); // creates a temp file and returns a path to it. extension if any should include the '.'
rlm@1 40 void ReleaseTempFile(const char* filename); // deletes a particular temporary file, by filename
rlm@1 41 int ChooseItemFromArchive(ArchiveFile& archive, bool autoChooseIfOnly1=true, const char** ignoreExtensions=0, int numIgnoreExtensions=0); // gets an index to a file within an already-open archive, using the file chooser if there's more than one choice
rlm@1 42
rlm@1 43 #endif