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