= RFC 12: Improved File Management = Author: Frank Warmerdam[[BR]] Contact: warmerdam@pobox.com[[BR]] Status: Development == Summary == Some applications using GDAL have a requirement to provide file management operations through the GUI. This includes deleting, renaming, moving and packaging up datasets which often requires operations on several associated files. This RFC introduces an operation on a GDALDataset to identify all the dataset files, and operations move, and rename them. == GetFileList() == The following new virtual method is added on the GDALDataset class, with an analygous C function. {{{ virtual char **GDALDataset::GetFileList(void); }}} 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. The GDALPamDataset::GetFileList() method will add the ability to find .aux and .aux.xml files associated with a dataset to the core default behavior. == pfnRename() == The following new function is added to the GDALDriver class. {{{ CPLErr (*pfnRename)( const char *pszOldName, const char *pszNewName ); }}} Also a corresponding function is added to the C API. {{{ CPLErr GDALRenameDataset( GDALDriverH hDriver, const char *pszOldName, const char *pszNewName ); }}} 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. 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. Optionally a NULL hDriver argument may be passed in, in which case the appropriate driver will be selected by first opening the datasource. == pfnMove() == ... similar to rename, but uses CPLCopyFile() to move files allowing cross filesystem operations. == pfnDelete() == The delete operations default implementation will be extended to use the GetFileList() results. == Supporting Functions == Some sort of supporting functions should be provided to make it easy to identify worldfiles, .aux files and .prj files associated with a file.