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
User avatar
emeasoft
Posts: 1062
Joined: Wed Apr 01, 2009 4:12 pm
Location: emeasoft
Contact:

Fix ZipFile

Postby emeasoft » Tue Nov 05, 2013 1:59 pm

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
User avatar
ignacio
Site Admin
Posts: 8556
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Fix ZipFile

Postby ignacio » Tue Nov 05, 2013 2:39 pm

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
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
User avatar
emeasoft
Posts: 1062
Joined: Wed Apr 01, 2009 4:12 pm
Location: emeasoft
Contact:

Fix ZipFile

Postby emeasoft » Wed Nov 06, 2013 11:43 am

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)Â
User avatar
ignacio
Site Admin
Posts: 8556
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Fix ZipFile

Postby ignacio » Wed Nov 06, 2013 12:28 pm

emeasoft escribió el mié, 06 noviembre 2013 11:43
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

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
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info

Return to “English”