Changes between Version 2 and Version 3 of rfc12_filemanagement
- Timestamp:
- Apr 30, 2007, 7:52:09 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
rfc12_filemanagement
v2 v3 19 19 The method is intended to return a list of files associated with this open dataset. The return is a NULL terminated string list which becomes owned by the caller and should be deallocated with CSLDestroy(). The default implementation tests the name of the datasource to see if it is a file, and if so it is returned otherwise an empty list is returned. 20 20 21 The GDALPamDataset:: GetFileList() method will add the ability to find .aux and .aux.xml files associated with a dataset to the core default behavior.21 The GDALPamDataset::!GetFileList() method will add the ability to find .aux and .aux.xml files associated with a dataset to the core default behavior. 22 22 23 23 == pfnRename() == … … 26 26 27 27 {{{ 28 CPLErr (*pfnRename)( const char *psz OldName, const char *pszNewName );28 CPLErr (*pfnRename)( const char *pszNewName, const char *pszOldName ); 29 29 }}} 30 30 … … 32 32 33 33 {{{ 34 CPLErr GDALRenameDataset( GDALDriverH hDriver, const char *psz OldName, const char *pszNewName );34 CPLErr GDALRenameDataset( GDALDriverH hDriver, const char *pszNewName, const char *pszOldName ); 35 35 }}} 36 36 37 37 Note that renaming is done by the driver, but the dataset to be operated on should '''not''' be open at the time. GDALRenameDataset() will invoke pfnRename if it is non-NULL. 38 38 39 If pfnRename is NULL the default implementation will be used which will open the dataset, fetch the file list, close the dataset, and then try to rename all the files (based on shared basenames). The default rename operation will fail if it is unable to establish a relationship between the files (ie. a common basename or stem) to indicate how the group of files should be rename to the new pattern. The default rename operation will use VSIRename() to rename the files, so this function may only be suitable if they remain in the same filesystem or even directory.39 If pfnRename is NULL the default implementation will be used which will open the dataset, fetch the file list, close the dataset, and then try to rename all the files (based on shared basenames). The default rename operation will fail if it is unable to establish a relationship between the files (ie. a common basename or stem) to indicate how the group of files should be rename to the new pattern. 40 40 41 41 Optionally a NULL hDriver argument may be passed in, in which case the appropriate driver will be selected by first opening the datasource. 42 42 43 == pfnMove() ==43 === CPLRenameOrCopy() === 44 44 45 ... similar to rename, but uses CPLCopyFile() to move files allowing cross filesystem operations. 45 The POSIX rename() function on which VSIRename() is usually based does not normally allow renaming files between file systems or between different kinds of file systems (ie. /vsimem to C:/abc). In order to implement GDALRenameDataset() such that it works efficiently within a file system, but still works between file systems, a new operation will be added to gdal/port. This is the CPLRenameOrCopy() function which will first try a VSIRename(). If that fails it will use CPLCopyFile() to copy the whole file and then VSIUnlink() to get rid of the old file. 46 47 {{{ 48 int CPLRenameOrCopy( const char *pszNewFilename, const char *pszOldFilename ); 49 }}} 50 51 The return value will be zero on success, otherwise an errno style value. 52 53 It should be noted that in some error conditions, such as the destination file system running out of space during a copy, it may happen that some files for a dataset get renamed, and some do not leaving things in an inconsistent state. 46 54 47 55 == pfnDelete() ==