List files and fix scrolling

This commit is contained in:
Krzosa Karol
2024-07-24 14:16:58 +02:00
parent 93e0104c1e
commit cb4f380313
6 changed files with 45 additions and 3 deletions

View File

@@ -299,3 +299,21 @@ bool IsFile(String path) {
bool is_file = (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) == 0;
return dwAttrib != INVALID_FILE_ATTRIBUTES && is_file;
}
String GetWorkingDir(Allocator arena) {
wchar_t wbuffer[1024];
DWORD wsize = GetCurrentDirectoryW(Lengthof(wbuffer), wbuffer);
Assert(wsize != 0);
Assert(wsize < 1022);
wbuffer[wsize++] = '/';
wbuffer[wsize] = 0;
String path = ToString(arena, wbuffer, wsize);
NormalizePathInPlace(path);
return path;
}
bool IsAbsolute(String path) {
bool result = path.len > 3 && IsAlphabetic(path.data[0]) && path.data[1] == ':' && path.data[2] == '/';
return result;
}