]> git.tdb.fi Git - libs/core.git/blob - source/fs/windows/utils.cpp
Move most platform-specific code into overlay directories
[libs/core.git] / source / fs / windows / utils.cpp
1 #include <windows.h>
2 #include <msp/core/systemerror.h>
3 #include "dir.h"
4 #include "utils.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace FS {
10
11 Path readlink(const Path &link)
12 {
13         (void)link;
14         throw logic_error("no symbolic links on win32");
15 }
16
17 Path realpath(const Path &path)
18 {
19         if(path.is_absolute())
20                 return path;
21         else
22                 return getcwd()/path;
23 }
24
25 void rename(const Path &from, const Path &to)
26 {
27         if(!MoveFileEx(from.c_str(), to.c_str(), MOVEFILE_REPLACE_EXISTING))
28                 throw system_error("MoveFileEx");
29 }
30
31 void unlink(const Path &path)
32 {
33         if(!DeleteFile(path.c_str()))
34                 throw system_error("DeleteFile");
35 }
36
37 } // namespace FS
38 } // namespace Msp