51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
#pragma once
|
|
#include "../basic/basic.h"
|
|
|
|
struct FileIter {
|
|
bool is_valid;
|
|
bool is_directory;
|
|
String absolute_path;
|
|
String relative_path;
|
|
String filename;
|
|
|
|
String path;
|
|
Allocator allocator;
|
|
Arena *arena;
|
|
TempArena temp;
|
|
union {
|
|
struct Win32_FileIter *w32;
|
|
void *dir;
|
|
};
|
|
};
|
|
|
|
String ReadFile(Allocator arena, String path);
|
|
bool WriteFile(String path, String data);
|
|
String GetAbsolutePath(Allocator arena, String relative);
|
|
bool IsValid(const FileIter &it);
|
|
void Advance(FileIter *it);
|
|
FileIter IterateFiles(Allocator allocator, String path);
|
|
void InitOS(void (*error_proc)(const char *, ...));
|
|
|
|
String GetExePath(Allocator allocator);
|
|
String GetExeDir(Allocator allocator);
|
|
bool FileExists(String path);
|
|
bool IsDir(String path);
|
|
bool IsFile(String path);
|
|
String GetWorkingDir(Allocator arena);
|
|
bool IsAbsolute(String path);
|
|
|
|
struct Process {
|
|
bool is_valid;
|
|
int exit_code;
|
|
char platform[6 * 8];
|
|
|
|
int64_t view_id; // text editor view
|
|
bool scroll_to_end;
|
|
};
|
|
|
|
Process SpawnProcess(String command_line, String working_dir, String write_stdin = {});
|
|
bool IsValid(Process *process);
|
|
void KillProcess(Process *process);
|
|
String PollStdout(Allocator allocator, Process *process);
|
|
void WriteStdin(Process *process, String string);
|
|
void CloseStdin(Process *process); |