Click here to Skip to main content
15,887,998 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
This is what I tried, but it is not working:

C++
ZRESULT TUnzip::Open(void *z,unsigned int len,DWORD flags)
{
    if (uf!=0 || currentfile!=-1) 
        return ZR_NOTINITED;

    GetCurrentDirectory(MAX_PATH,rootdir);
    _tcscat(rootdir,_T("\\temp")); //add temp dir, but can not work 
    _tcscat(rootdir,_T("\\");

    if (flags==ZIP_HANDLE)
    { 
        DWORD type = GetFileType(z);
        if (type!=FILE_TYPE_DISK) 
            return ZR_SEEK;
    }
    ZRESULT e; 
    LUFILE *f = lufopen(z,len,flags,&e);
    if (f==NULL) 
        return e;
    uf = unzOpenInternal(f);
    //return ZR_OK;
    return zopenerror; //+++1.2
}
Posted
Updated 23-May-14 1:21am
v4
Comments
Prasad Khandekar 16-May-14 6:01am    
I think you will have to call SetUnzipBaseDir to set the folder.
Richard MacCutchan 16-May-14 7:02am    
You create rootdir but you never use it for anything.

1 solution

you need to specify a full path.

With GetFolderPath you get the right one.

Remember: you cant write everywhere for security reasons...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900