linux wip

This commit is contained in:
Mikulas Florek 2020-02-12 21:58:42 +01:00
parent 7cc12ef053
commit 744ea21313
3 changed files with 20 additions and 5 deletions

View file

@ -19,7 +19,7 @@ namespace Debug
void debugOutput(const char* message)
{
puts(message);
printf("%s", message);
}

View file

@ -1,5 +1,6 @@
#include "engine/fibers.h"
#include "engine/lumix.h"
#include "engine/profiler.h"
#include <ucontext.h>
#include <stdlib.h>
#include <string.h>
@ -48,6 +49,7 @@ void destroy(Handle fiber)
void switchTo(Handle* prev, Handle fiber)
{
Profiler::beforeFiberSwitch();
swapcontext(prev, &fiber);
}

View file

@ -278,7 +278,7 @@ static void processEvents()
void destroyWindow(WindowHandle window)
{
ASSERT(false);
//ASSERT(false);
// TODO
}
@ -661,9 +661,22 @@ void unclipCursor()
bool copyFile(const char* from, const char* to)
{
////ASSERT(false);
// TODO
return {};
const int source = open(from, O_RDONLY, 0);
if (source < 0) return false;
const int dest = open(to, O_WRONLY | O_CREAT, 0644);
if (dest < 1) {
close(source);
return false;
}
char buf[BUFSIZ];
size_t size;
while ((size = read(source, buf, BUFSIZ)) > 0) {
write(dest, buf, size);
}
close(source);
close(dest);
}