Mercurial > vba-clojure
view src/win32/7zip/OpenArchive.h @ 5:8fe0c57e53d2
concentrating on lua first
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:39:40 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 // for retrieving files from archives and/or managing temporary files3 #ifndef OPENARCHIVE_HEADER4 #define OPENARCHIVE_HEADER6 #include "7zip.h"8 // ObtainFile()9 // this is the main, high-level function for opening possibly-compressed files.10 // you don't need to check whether the file is compressed beforehand,11 // this function will figure that out and work correctly either way.12 // it also does the work of bringing up a within-archive file selector dialog if necessary,13 // which even allows navigating to a file within an archive that's within the archive.14 // the output PhysicalName is the filename of an uncompressed file15 // for you to load with fopen or whatever,16 // unless the function fails (or is cancelled) in which case it will return false.17 // example input Name: "C:\games.zip"18 // example output LogicalName: "C:\games.zip|Metroid.gba"19 // example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\VBA\rom7A37.gba"20 // assumes the three name arguments are distinct character buffers with exactly 2048 bytes each21 bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category=NULL, const char** ignoreExtensions=NULL, int numIgnoreExtensions=0);23 // ReleaseTempFileCategory()24 // this is for deleting the temporary files that ObtainFile() can create.25 // using it is optional because they will auto-delete on proper shutdown of the program,26 // but it's nice to be able to clean up the files as early as possible.27 // pass in the same "category" string you passed into ObtainFile(),28 // and this will delete all files of that category.29 // you can optionally specify one filename to not delete even if its category matches.30 // note that any still-open files cannot be deleted yet and will be skipped.31 void ReleaseTempFileCategory(const char* category, const char* exceptionFilename=NULL);33 // sets the parent window of subsequent archive selector dialogs34 // NULL resets this to the default (main VBA emulator window)35 void SetArchiveParentHWND(void* hwnd=NULL);37 // the rest of these are more internal utility functions,38 // but they could be generally useful outside of that39 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 '.'40 void ReleaseTempFile(const char* filename); // deletes a particular temporary file, by filename41 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 choice43 #endif