Skip to content

Commit

Permalink
Merge pull request #2783 from 9rnsr/fix_imports
Browse files Browse the repository at this point in the history
Add missing imports
  • Loading branch information
H. S. Teoh committed Dec 4, 2014
2 parents 9a46840 + c6d1f79 commit e9eb01b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions std/file.d
Expand Up @@ -479,7 +479,11 @@ void rename(in char[] from, in char[] to) @trusted
to)));
}
else version(Posix)
{
import core.stdc.stdio;

cenforce(core.stdc.stdio.rename(from.tempCString(), to.tempCString()) == 0, to);
}
}

@safe unittest
Expand All @@ -506,8 +510,12 @@ void remove(in char[] name) @trusted
cenforce(DeleteFileW(name.tempCStringW()), name);
}
else version(Posix)
{
import core.stdc.stdio;

cenforce(core.stdc.stdio.remove(name.tempCString()) == 0,
"Failed to remove file " ~ name);
}
}

version(Windows) private WIN32_FILE_ATTRIBUTE_DATA getFileAttributesWin(in char[] name) @trusted
Expand Down Expand Up @@ -2477,6 +2485,8 @@ void copy(in char[] from, in char[] to)
}
else version(Posix)
{
import core.stdc.stdio;

immutable fd = core.sys.posix.fcntl.open(from.tempCString(), O_RDONLY);
cenforce(fd != -1, from);
scope(exit) core.sys.posix.unistd.close(fd);
Expand Down

0 comments on commit e9eb01b

Please sign in to comment.