Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation

ZipPlatform Namespace Reference

Enumerations

enum  DeleteFileMode { dfmRegular = 0x00, dfmRemoveReadOnly = 0x01, dfmRecycleBin = 0x02 }

Functions

ZIP_API void AnsiOem (CZipAutoBuffer &buffer, bool bAnsiToOem)
ZIP_API int FileExists (LPCTSTR lpszName)
ZIP_API DWORD GetDefaultAttributes ()
ZIP_API DWORD GetDefaultDirAttributes ()
ZIP_API ULONGLONG GetDeviceFreeSpace (LPCTSTR lpszPath)
ZIP_API bool GetSystemCaseSensitivity ()
ZIP_API int GetSystemID ()
ZIP_API CZipString GetTmpFileName (LPCTSTR lpszPath=NULL, ZIP_SIZE_TYPE uSizeNeeded=0)
ZIP_API bool IsDirectory (DWORD uAttr)
ZIP_API bool IsDriveRemovable (LPCTSTR lpszFilePath)
ZIP_API int MultiByteToWide (const CZipAutoBuffer &szIn, CZipString &szOut, UINT uCodePage)
ZIP_API int WideToMultiByte (LPCWSTR lpszIn, CZipAutoBuffer &szOut, UINT uCodePage)
Various operations on files and directories.

If the functions returns a bool value, then true indicates that the operation was successful.

ZIP_API bool GetCurrentDirectory (CZipString &sz)
 Returns the current directory and stores it in sz.
ZIP_API bool ChangeDirectory (LPCTSTR lpDirectory)
 Changes the current directory.
ZIP_API bool SetFileAttr (LPCTSTR lpFileName, DWORD uAttr)
 Sets the file attributes.
ZIP_API bool GetFileAttr (LPCTSTR lpFileName, DWORD &uAttr)
 Returns the file attributes.
ZIP_API bool GetFileModTime (LPCTSTR lpFileName, time_t &ttime)
 Returns the file modification time.
ZIP_API bool SetFileModTime (LPCTSTR lpFileName, time_t ttime)
 Set the file modification time.
ZIP_API bool GetFileSize (LPCTSTR lpszFileName, ZIP_SIZE_TYPE &dSize)
 Returns the file size.
ZIP_API bool CreateNewDirectory (LPCTSTR lpDirectory)
 Creates a new directory.
ZIP_API bool SetVolLabel (LPCTSTR lpszPath, LPCTSTR lpszLabel)
 Sets a label on a removable device. lpszPath may point to a file on the device.
ZIP_API bool ForceDirectory (LPCTSTR lpDirectory)
 Creates nested directories at once.
ZIP_API bool RemoveFile (LPCTSTR lpszFileName, bool bThrow=true, int iMode=dfmRegular)
 Removes a file.
ZIP_API bool RenameFile (LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow=true)
 Renames a file.
ZIP_API bool SetFileAttr (HANDLE handle, DWORD uAttr)
 Sets the file attributes.
ZIP_API bool SetFileModTime (HANDLE handle, time_t ttime)
 Set the file modification time.
ZIP_API bool TruncateFile (int iDes, ULONGLONG uSize)
ZIP_API int OpenFile (LPCTSTR lpszFileName, UINT iMode, int iShareMode)
ZIP_API bool FlushFile (int iDes)
ZIP_API intptr_t GetFileSystemHandle (int iDes)

Detailed Description

Includes functions that require system-specific implementation.


Enumeration Type Documentation

The mode for deleting files.

Enumerator:
dfmRegular 

No special action is taken when overwriting a file.

dfmRemoveReadOnly 

The read-only attribute is cleared before overwriting a file.

dfmRecycleBin 

The overwritten file is moved to the Recycle Bin (Windows only).


Function Documentation

ZIP_API void ZipPlatform::AnsiOem ( CZipAutoBuffer &  buffer,
bool  bAnsiToOem 
)

Performs the translation between ANSI and OEM character sets.

Parameters:
bufferThe buffer containing characters to be translated.
bAnsiToOemIf true, convert ANSI to OEM; if false, OEM to ANSI.
ZIP_API bool ZipPlatform::ChangeDirectory ( LPCTSTR  lpDirectory )

Changes the current directory.

ZIP_API bool ZipPlatform::CreateNewDirectory ( LPCTSTR  lpDirectory )

Creates a new directory.

ZIP_API int ZipPlatform::FileExists ( LPCTSTR  lpszName )

Checks if the given file or directory exists.

Parameters:
lpszNameThe path to the file or directory to test.
Returns:
One of the following values:
  • -1 : the given file exists and is a directory
  • 1 : the given file exists and is a regular file
  • 0 : there is no such a file
ZIP_API bool ZipPlatform::FlushFile ( int  iDes )

Flushes the file to the disk.

Note:
Defined only in the STL version.
ZIP_API bool ZipPlatform::ForceDirectory ( LPCTSTR  lpDirectory )

Creates nested directories at once.

ZIP_API bool ZipPlatform::GetCurrentDirectory ( CZipString &  sz )

Returns the current directory and stores it in sz.

ZIP_API DWORD ZipPlatform::GetDefaultAttributes (  )

Returns the default file attributes for the current system.

Returns:
The default file attributes.
ZIP_API DWORD ZipPlatform::GetDefaultDirAttributes (  )

Returns the default directory attributes for the current system.

Returns:
The default directory attributes.
ZIP_API ULONGLONG ZipPlatform::GetDeviceFreeSpace ( LPCTSTR  lpszPath )

Returns the free space on the given device.

Parameters:
lpszPathPoints to the device to test.
Returns:
The free space in bytes.
ZIP_API bool ZipPlatform::GetFileAttr ( LPCTSTR  lpFileName,
DWORD &  uAttr 
)

Returns the file attributes.

ZIP_API bool ZipPlatform::GetFileModTime ( LPCTSTR  lpFileName,
time_t &  ttime 
)

Returns the file modification time.

ZIP_API bool ZipPlatform::GetFileSize ( LPCTSTR  lpszFileName,
ZIP_SIZE_TYPE &  dSize 
)

Returns the file size.

ZIP_API intptr_t ZipPlatform::GetFileSystemHandle ( int  iDes )

Returns the underlying system handle.

Note:
Defined only in the STL version.
ZIP_API bool ZipPlatform::GetSystemCaseSensitivity (  )

Returns the default case-sensitivity for the current file system.

Returns:
true, if the system is case-sensitive; false otherwise.
ZIP_API int ZipPlatform::GetSystemID (  )

Returns the current system identifier.

Returns:
One of the ZipCompatibility::ZipPlatforms values.
See also:
CZipArchive::SetSystemCompatibility
ZIP_API CZipString ZipPlatform::GetTmpFileName ( LPCTSTR  lpszPath = NULL,
ZIP_SIZE_TYPE  uSizeNeeded = 0 
)

Returns the name of a temporary file ensuring there is enough free space in the destination directory.

Parameters:
lpszPathThe path to the directory to initially create the file in.
uSizeNeededThe requested free space size in bytes. If set to 0, the space availability is not checked.
ZIP_API bool ZipPlatform::IsDirectory ( DWORD  uAttr )

Checks if the given attributes represent a directory.

Parameters:
uAttrThe attributes to test.
Returns:
true if the attributes represent a directory; false otherwise.
ZIP_API bool ZipPlatform::IsDriveRemovable ( LPCTSTR  lpszFilePath )

Checks if the given drive is removable.

Parameters:
lpszFilePathThe path to the drive. May point to a file path or a directory on the drive.
Returns:
true. if the drive is removable; false otherwise.
Note:
Implemented only on Windows system, on all others always returns true.
ZIP_API int ZipPlatform::MultiByteToWide ( const CZipAutoBuffer &  szIn,
CZipString &  szOut,
UINT  uCodePage 
)

Converts a multi-byte character string to a wide character string.

Parameters:
szInThe multi-byte character string to convert. Should not contain the terminating NULL character.
szOutReceives the converted string.
uCodePageThe code page used in conversion.
Returns:
The length of the string after the conversion (without the terminating NULL character) or -1 when the function did not succeed.
Note:
Defined only in the UNICODE version.
ZIP_API int ZipPlatform::OpenFile ( LPCTSTR  lpszFileName,
UINT  iMode,
int  iShareMode 
)

Opens the file.

Note:
Defined only in the STL version.
ZIP_API bool ZipPlatform::RemoveFile ( LPCTSTR  lpszFileName,
bool  bThrow = true,
int  iMode = dfmRegular 
)

Removes a file.

ZIP_API bool ZipPlatform::RenameFile ( LPCTSTR  lpszOldName,
LPCTSTR  lpszNewName,
bool  bThrow = true 
)

Renames a file.

ZIP_API bool ZipPlatform::SetFileAttr ( HANDLE  handle,
DWORD  uAttr 
)

Sets the file attributes.

ZIP_API bool ZipPlatform::SetFileAttr ( LPCTSTR  lpFileName,
DWORD  uAttr 
)

Sets the file attributes.

ZIP_API bool ZipPlatform::SetFileModTime ( LPCTSTR  lpFileName,
time_t  ttime 
)

Set the file modification time.

ZIP_API bool ZipPlatform::SetFileModTime ( HANDLE  handle,
time_t  ttime 
)

Set the file modification time.

ZIP_API bool ZipPlatform::SetVolLabel ( LPCTSTR  lpszPath,
LPCTSTR  lpszLabel 
)

Sets a label on a removable device. lpszPath may point to a file on the device.

ZIP_API bool ZipPlatform::TruncateFile ( int  iDes,
ULONGLONG  uSize 
)

Truncates the file.

Note:
Defined only in the STL version.
ZIP_API int ZipPlatform::WideToMultiByte ( LPCWSTR  lpszIn,
CZipAutoBuffer &  szOut,
UINT  uCodePage 
)

Converts a wide character string to a multi-byte character string.

Parameters:
lpszInThe wide character string to convert.
szOutThe buffer to receive the converted string. Does not contain the terminating NULL character.
uCodePageThe code page used in conversion.
Returns:
The szOut buffer length, or -1 when not succeeded.
Note:
Defined only in the UNICODE version.
Back To Top Up