]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/windows/utils.cpp
Move most platform-specific code into overlay directories
[libs/core.git] / source / fs / windows / utils.cpp
diff --git a/source/fs/windows/utils.cpp b/source/fs/windows/utils.cpp
new file mode 100644 (file)
index 0000000..ca9e7aa
--- /dev/null
@@ -0,0 +1,38 @@
+#include <windows.h>
+#include <msp/core/systemerror.h>
+#include "dir.h"
+#include "utils.h"
+
+using namespace std;
+
+namespace Msp {
+namespace FS {
+
+Path readlink(const Path &link)
+{
+       (void)link;
+       throw logic_error("no symbolic links on win32");
+}
+
+Path realpath(const Path &path)
+{
+       if(path.is_absolute())
+               return path;
+       else
+               return getcwd()/path;
+}
+
+void rename(const Path &from, const Path &to)
+{
+       if(!MoveFileEx(from.c_str(), to.c_str(), MOVEFILE_REPLACE_EXISTING))
+               throw system_error("MoveFileEx");
+}
+
+void unlink(const Path &path)
+{
+       if(!DeleteFile(path.c_str()))
+               throw system_error("DeleteFile");
+}
+
+} // namespace FS
+} // namespace Msp