mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
* 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
This commit is contained in:
@@ -1,6 +1,26 @@
|
||||
//+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] == '/');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user