In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Fix ZipFile

Xailer professional forum in English
Responder
Avatar de Usuario
emeasoft
Mensajes: 1094
Registrado: Mié Abr 01, 2009 4:12 pm
Ubicación: emeasoft
Contactar:

Fix ZipFile

Mensaje por emeasoft »

Hello Ignacio,
If the path of the files to zip was only one, it was compacting only the contents from that dir... so I changed this on the class to solve the problem.
Here is the fix for the TZipFile:

METHOD CommonMaskPath() CLASS XZipFile
LOCAL cPath, cMask
LOCAL nLen, nPos, nFor
LOCAL l01:=.F.
IF ValType( ::aFileMask ) == "C"
::aFileMask := { ::aFileMask }
ENDIF
cPath := ::aFileMask[ 1 ]
FOR nFor := 2 TO Len( ::aFileMask )
cMask := ::aFileMask[ nFor ]
nPos := 1
nLen := Min( Len( cPath ), Len( cMask ) )
DO WHILE nPos <= nLen
IF Upper( Left( cPath, nPos ) ) == Upper( Left( cMask, nPos ) )
nPos++
ELSE
IF ""$SubStr(cMask,nPos)
l01:=.T.
ENDIF
EXIT
ENDIF
ENDDO
cPath := Left( cPath, nPos - 1 )
IF Empty( cPath )
EXIT
ENDIF
NEXT
IF ( nPos := RAt( "", cPath ) ) > 0
cPath := Left( cPath, nPos )
ENDIF

IF !l01
IF ( nPos := HB_At( "", cPath ) ) > 0
cPath := Left( cPath, nPos )
ENDIF
ENDIF
RETURN cPath

Regards,
Juliano
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9442
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Fix ZipFile

Mensaje por ignacio »

Hello,
Thanks your code, but before including it I need to understand the problem and your solution. A small sample would be great. TIA.
Regards
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Avatar de Usuario
emeasoft
Mensajes: 1094
Registrado: Mié Abr 01, 2009 4:12 pm
Ubicación: emeasoft
Contactar:

Fix ZipFile

Mensaje por emeasoft »

Hello Ignacio,
The problem is that it is compacting the content of a folder, when there is only one path to compact and it is not making its folder tree...
I made two examples to show that.
TIA,
Juliano

Attached files Test-with-fix.zip (6.8 KB)Â Test-without-fix.zip (2.7 KB)Â
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9442
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Fix ZipFile

Mensaje por ignacio »

emeasoft escribió el mié, 06 noviembre 2013 11:43Hello Ignacio,
The problem is that it is compacting the content of a folder, when there is only one path to compact and it is not making its folder tree...
I made two examples to show that.
TIA,
Juliano
Thanks for the sample. Ok, I understood the problem. Sorry for being so cautious and thank you again for your feedback.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder