Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IoVM] File moveTo #38

Open
superbobry opened this issue Apr 19, 2010 · 5 comments
Open

[IoVM] File moveTo #38

superbobry opened this issue Apr 19, 2010 · 5 comments

Comments

@superbobry
Copy link
Contributor

According to the docs:

Raises ... File nameConflict exception if the file nameString already exists.

The realities:
Io> f := File with("test.io") open close
==> File_0x9f73450:

Io> f exists
==> true
Io> File with(f path) exists
==> true
Io> File with("testAgain.io") open moveTo(f path)
==>  File_0x9f88808:
@stevedekorte
Copy link
Member

Why shouldn't it be a name conflict if your trying to move a file on top of one that already exists?

@superbobry
Copy link
Contributor Author

No idea. I was writing tests for Directory moveTo and since it's a wrapper around File moveTo I decided to test the behaviour, described in it's docstring, and it didn't work as described. That's the story :)

IO_METHOD(IoFile, moveTo_)
{
    /*doc File moveTo(pathString)
    Moves the file specified by the receiver's path to the
    new path pathString. Raises an File doesNotExist exception if the
    file does not exist or a File nameConflict exception if the file
    nameString already exists.
    */

    IoSymbol *newPath = IoMessage_locals_symbolArgAt_(m, locals, 0);
    const char *fromPath = CSTRING(DATA(self)->path);
    const char *toPath = CSTRING(newPath);

@stevedekorte
Copy link
Member

Oh, sorry - I thought you were saying it did raise an exception.

@mikedld
Copy link
Contributor

mikedld commented Jun 6, 2010

Seems that either code or documentation should be fixed since they strictly conflict with each other. Later in the code,

...
remove(toPath); // to make sure we do not get an error
...

@stevedekorte
Copy link
Member

Ok, lets' change the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants