Createpack & Files in Temp

Just starting out? Need help? Post your questions and find answers here.
Marty2PB
User
User
Posts: 28
Joined: Thu Mar 13, 2014 4:31 pm

Createpack & Files in Temp

Post by Marty2PB »

Hallo,

I've written a routine with which I pack files. However, these "libarchive_" files are not deleted after packing and remain in the Temp directory until the program ends.
I cannot delete the files either because they are still used by the program even though the file is already packed. If I now pack files that combine 12GB and pack each file individually, the files remain until the end of the program and my temp becomes fuller and fuller.

Image

Left are the libarchive_ Packed files in Temp.

Image

Can not Delete or Copy/Move. But are already packed (Right Window).


How can I unlock the files that have been packed with Creatpack?


--- Snippet

Code: Select all


Macro ReadFile2Mem(diFileName, PackedFile)
      Define MemoryImage = OpenFile( #PB_Any, diFileName,#PB_File_SharedRead|#PB_File_SharedWrite)
        
        If ( MemoryImage )                 
            uFileLen.l  = Lof ( MemoryImage )
            
            *FileMemory =  AllocateMemory( uFileLen )
            
            If ( *FileMemory )                  
                
                ReadedSize.q = ReadData( MemoryImage, *FileMemory, uFileLen)
                
                CloseFile(MemoryImage)
                                              
                 AddPackMemory(DC::#PACKING, *FileMemory , ReadedSize, PackedFile )
                                               
                 ClosePack( DC::#PACKING )                                                                                                               
                
                FreeMemory( *FileMemory )
            EndIf
            
        EndIf
EndMacro  

  If CreatePack(DC::#PACKING, szPackFile , CFG::*Exile\Archive\uPlugin ,CFG::*Exile\Archive\uLevel)                     
                            
                            ReadFile2Mem(ModsPak()\szDir + ModsPak()\szPak, Str( uSrcWsID ) + "\" + ModsPak()\szPak ) 
                            
                            System_Set_Priority( GetFilePart( ProgramFilename() ) , #NORMAL_PRIORITY_CLASS)
                            If ( uItem = MaxCnt )
                                Break
                            EndIf 
                            
                            Delay( 5 )
                            ClosePack( DC::#PACKING )                           
                            Delay( 5 )                           
                            Continue
                        EndIf 
                    Else
                        SetGadgetText( DC::#Text_006, GetFilePart( szPackFile,1 )) 
                        SetGadgetText( DC::#Text_007, "- Exists ... no action")
                    EndIf