2015-11-25 04:51:36 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
|
|
*
|
|
|
|
* This file is part of zig, which is MIT licensed.
|
|
|
|
* See http://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZIG_OS_HPP
|
|
|
|
#define ZIG_OS_HPP
|
|
|
|
|
|
|
|
#include "list.hpp"
|
|
|
|
#include "buffer.hpp"
|
|
|
|
|
2015-12-01 10:58:53 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-11-25 04:51:36 +08:00
|
|
|
void os_spawn_process(const char *exe, ZigList<const char *> &args, bool detached);
|
2015-11-26 16:29:52 +08:00
|
|
|
void os_exec_process(const char *exe, ZigList<const char *> &args,
|
|
|
|
int *return_code, Buf *out_stderr, Buf *out_stdout);
|
2015-11-25 04:51:36 +08:00
|
|
|
|
2015-11-25 10:07:33 +08:00
|
|
|
void os_path_split(Buf *full_path, Buf *out_dirname, Buf *out_basename);
|
2015-12-01 10:58:53 +08:00
|
|
|
void os_path_join(Buf *dirname, Buf *basename, Buf *out_full_path);
|
2015-12-16 12:48:41 +08:00
|
|
|
int os_path_real(Buf *rel_path, Buf *out_abs_path);
|
2015-11-25 10:07:33 +08:00
|
|
|
|
2015-11-26 16:29:52 +08:00
|
|
|
void os_write_file(Buf *full_path, Buf *contents);
|
|
|
|
|
2015-11-25 10:07:33 +08:00
|
|
|
|
2015-12-01 10:58:53 +08:00
|
|
|
int os_fetch_file(FILE *file, Buf *out_contents);
|
|
|
|
int os_fetch_file_path(Buf *full_path, Buf *out_contents);
|
|
|
|
|
|
|
|
int os_get_cwd(Buf *out_cwd);
|
|
|
|
|
2015-12-01 15:50:11 +08:00
|
|
|
bool os_stderr_tty(void);
|
|
|
|
|
2016-01-27 15:01:49 +08:00
|
|
|
int os_buf_to_tmp_file(Buf *contents, Buf *suffix, Buf *out_tmp_path);
|
|
|
|
int os_delete_file(Buf *path);
|
|
|
|
|
2015-11-25 04:51:36 +08:00
|
|
|
#endif
|