Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3608 closed defect (invalid)

Documentation incorrectly suggests that VSIRename is implemented for VSIMemFilesystemHandler

Reported by: des4maisons Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: Docs Version: unspecified
Severity: normal Keywords:
Cc:

Description

The description for VSIRename (see here ) states "This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory."

However, it does not appear to be implemented in the VSIMemFilesystemHandler. Moreover, when called, it returns an errorcode which does not suggest that it is not implemented. (It returns ENOENT -- see port/cpl_vsi_virtual.h, line 85.)

The documentation should warn the user that VSIRename is not implemented for the in-memory filesystem. Also, it would be nice if the error code specified by the VSIFilesystemHandler when features aren't implemented be different from any possible error that could happen because of user error.

Change History (2)

comment:1 by Even Rouault, 14 years ago

Resolution: invalid
Status: newclosed

The code work as documented. The Rename() method has an overloaded implementation in port/cpl_vsi_mem.cpp

The following test program runs flawlessly :

#include <cpl_vsi.h>
#include <assert.h>

int main(int argc, char* argv[])
{
    FILE* f = VSIFOpenL("/vsimem/foo", "w");
    VSIFCloseL(f);
    assert(VSIRename("/vsimem/foo", "/vsimem/bar") == 0);
    assert(VSIFOpenL("/vsimem/foo", "r") == NULL);
    assert(VSIFOpenL("/vsimem/bar", "r") != NULL);
    return 0;
}

comment:2 by Even Rouault, 14 years ago

Milestone: 1.7.21.8.0

Ah actually I realize VSIMemFilesystemHandler::Rename() was implemented just a few months ago in trunk (r18688), so you haven't dreamt ;-) Will be in 1.8.0

Note: See TracTickets for help on using tickets.