implemented file read/write functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "tlibc/filesystem.h"
|
||||
#include "io_includes.h"
|
||||
#include "internal.h"
|
||||
|
||||
bool dir_exists(cstr path){
|
||||
if(path[0]=='.'){
|
||||
@@ -8,7 +8,7 @@ bool dir_exists(cstr path){
|
||||
// else if(path[1]=='.' && path[2]==path_sep)
|
||||
//TODO path_resolve because windows doesnt recognize .\ pattern
|
||||
}
|
||||
#if KFS_USE_WINDOWS_H
|
||||
#if TLIBC_FS_USE_WINDOWS_H
|
||||
DWORD dwAttrib = GetFileAttributes(path);
|
||||
return (bool)(
|
||||
(dwAttrib != INVALID_FILE_ATTRIBUTES) && // file exists
|
||||
@@ -29,7 +29,7 @@ Result(void) dir_create(cstr path){
|
||||
char* parentDir= str_copy(path_dirname(str_from_cstr((void*)path))).data;
|
||||
try_void(dir_create(parentDir), free(parentDir));
|
||||
free(parentDir);
|
||||
#if KFS_USE_WINDOWS_H
|
||||
#if TLIBC_FS_USE_WINDOWS_H
|
||||
if(!CreateDirectory(path, NULL))
|
||||
#else
|
||||
if(mkdir(path, 0777) == -1)
|
||||
|
||||
Reference in New Issue
Block a user