Files
Odin/core/path/filepath/path_unix.odin
Luka Aleksić 92e23ec397 * Add some procedures to path_unix to mirror the path_windows API
* Add files stat_linux and dir_linux to mirror the stat/dir_windows API
* Add helper functions to os_linux that are used by the above
2021-01-21 20:20:38 +01:00

27 lines
570 B
Odin

//+build linux, darwin, freebsd
package filepath
import "core:strings"
import "core:os"
SEPARATOR :: '/';
SEPARATOR_STRING :: `/`;
LIST_SEPARATOR :: ':';
abs :: proc(path: string, allocator := context.allocator) -> (string, bool) {
full_path, err := os.absolute_path_from_relative(path);
if err != os.ERROR_NONE {
return "", false;
}
return full_path, true;
}
join :: proc(elems: ..string, allocator := context.allocator) -> string {
s := strings.join(elems, SEPARATOR_STRING);
return s;
}
is_abs :: proc(path: string) -> bool {
return (path[0] == '/');
}