mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-25 13:05:00 -07:00
removed dependency on os_ext
This commit is contained in:
+1
-3
@@ -84,7 +84,6 @@
|
||||
#include "path_ext/path.h"
|
||||
#include "hash_table.h"
|
||||
#include "thread_pool/thread_pool.h"
|
||||
#include "os_ext/os_inc.h"
|
||||
#include "codeview_ext/codeview.h"
|
||||
#include "pdb_ext/msf_builder.h"
|
||||
#include "pdb_ext/pdb.h"
|
||||
@@ -95,7 +94,6 @@
|
||||
#include "path_ext/path.c"
|
||||
#include "hash_table.c"
|
||||
#include "thread_pool/thread_pool.c"
|
||||
#include "os_ext/os_inc.c"
|
||||
#include "codeview_ext/codeview.c"
|
||||
#include "pdb_ext/msf_builder.c"
|
||||
#include "pdb_ext/pdb.c"
|
||||
@@ -3671,7 +3669,7 @@ l.count += 1; \
|
||||
}
|
||||
|
||||
// search disk for library
|
||||
String8List match_list = os_file_search(scratch.arena, config->lib_dir_list, path);
|
||||
String8List match_list = lnk_file_search(scratch.arena, config->lib_dir_list, path);
|
||||
String8 absolute_path = match_list.node_count ? match_list.first->string : str8_zero();
|
||||
|
||||
// default to first match
|
||||
|
||||
@@ -579,14 +579,14 @@ lnk_make_code_view_input(TP_Context *tp, TP_Arena *tp_arena, String8List lib_dir
|
||||
CV_TypeServerInfo ts = cv_type_server_info_from_leaf(leaf);
|
||||
|
||||
// search disk for type server
|
||||
String8List match_list = os_file_search(scratch.arena, lib_dir_list, ts.name);
|
||||
String8List match_list = lnk_file_search(scratch.arena, lib_dir_list, ts.name);
|
||||
|
||||
// chop file name from path and search on it
|
||||
//
|
||||
// TODO: check if ts.name is a path and in that case do file search
|
||||
if (match_list.node_count == 0) {
|
||||
String8 file_name = str8_skip_last_slash(ts.name);
|
||||
match_list = os_file_search(scratch.arena, lib_dir_list, file_name);
|
||||
match_list = lnk_file_search(scratch.arena, lib_dir_list, file_name);
|
||||
}
|
||||
|
||||
B32 do_debug_info_discard = 0;
|
||||
|
||||
@@ -124,3 +124,50 @@ lnk_write_data_to_file_path(String8 path, String8 data)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal String8List
|
||||
lnk_file_search(Arena *arena, String8List dir_list, String8 file_path)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List match_list; MemoryZeroStruct(&match_list);
|
||||
|
||||
if (os_file_path_exists(file_path)) {
|
||||
String8 str = push_str8_copy(arena, file_path);
|
||||
str8_list_push(arena, &match_list, str);
|
||||
}
|
||||
|
||||
PathStyle file_path_style = path_style_from_str8(file_path);
|
||||
B32 is_relative = file_path_style != PathStyle_WindowsAbsolute &&
|
||||
file_path_style != PathStyle_UnixAbsolute;
|
||||
|
||||
if (is_relative) {
|
||||
for (String8Node *i = dir_list.first; i != 0; i = i->next) {
|
||||
String8List path_list = {0};
|
||||
str8_list_push(scratch.arena, &path_list, i->string);
|
||||
str8_list_push(scratch.arena, &path_list, file_path);
|
||||
String8 path = str8_path_list_join_by_style(scratch.arena, &path_list, PathStyle_SystemAbsolute);
|
||||
B32 file_exists = os_file_path_exists(path);
|
||||
if (file_exists) {
|
||||
B32 is_unique = 1;
|
||||
OS_FileID file_id = os_id_from_file_path(path);
|
||||
for (String8Node *k = match_list.first; k != 0; k = k->next) {
|
||||
OS_FileID test_id = os_id_from_file_path(k->string);
|
||||
int cmp = os_file_id_compare(test_id, file_id) != 0;
|
||||
if (cmp == 0) {
|
||||
is_unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_unique) {
|
||||
String8 str = push_str8_copy(arena, path);
|
||||
str8_list_push(arena, &match_list, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return match_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
typedef struct
|
||||
{
|
||||
String8Array path_arr;
|
||||
@@ -10,10 +12,13 @@ typedef struct
|
||||
U8 *buffer;
|
||||
} LNK_DiskReader;
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal String8 lnk_read_data_from_file_path(Arena *arena, String8 path);
|
||||
internal String8Array lnk_read_data_from_file_path_parallel(TP_Context *tp, Arena *arena, String8Array path_arr);
|
||||
|
||||
internal void lnk_write_data_list_to_file_path(String8 path, String8List list);
|
||||
internal void lnk_write_data_to_file_path(String8 path, String8 data);
|
||||
|
||||
internal String8List lnk_file_search(Arena *arena, String8List dir_list, String8 file_path);
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
internal String8List
|
||||
os_file_search(Arena *arena, String8List dir_list, String8 file_path)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List match_list; MemoryZeroStruct(&match_list);
|
||||
|
||||
if (os_file_path_exists(file_path)) {
|
||||
String8 str = push_str8_copy(arena, file_path);
|
||||
str8_list_push(arena, &match_list, str);
|
||||
}
|
||||
|
||||
PathStyle file_path_style = path_style_from_str8(file_path);
|
||||
B32 is_relative = file_path_style != PathStyle_WindowsAbsolute &&
|
||||
file_path_style != PathStyle_UnixAbsolute;
|
||||
|
||||
if (is_relative) {
|
||||
for (String8Node *i = dir_list.first; i != 0; i = i->next) {
|
||||
String8List path_list = {0};
|
||||
str8_list_push(scratch.arena, &path_list, i->string);
|
||||
str8_list_push(scratch.arena, &path_list, file_path);
|
||||
String8 path = str8_path_list_join_by_style(scratch.arena, &path_list, PathStyle_SystemAbsolute);
|
||||
B32 file_exists = os_file_path_exists(path);
|
||||
if (file_exists) {
|
||||
B32 is_unique = 1;
|
||||
OS_FileID file_id = os_id_from_file_path(path);
|
||||
for (String8Node *k = match_list.first; k != 0; k = k->next) {
|
||||
OS_FileID test_id = os_id_from_file_path(k->string);
|
||||
int cmp = os_file_id_compare(test_id, file_id) != 0;
|
||||
if (cmp == 0) {
|
||||
is_unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_unique) {
|
||||
String8 str = push_str8_copy(arena, path);
|
||||
str8_list_push(arena, &match_list, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return match_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#pragma once
|
||||
|
||||
internal String8List os_file_search(Arena *arena, String8List dir_list, String8 file_path);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#include "core/os_core.c"
|
||||
|
||||
#if OS_WINDOWS
|
||||
//# include "core/win32/os_core_win32.c"
|
||||
#elif OS_LINUX
|
||||
//# include "core/linux/os_core_linux.c"
|
||||
#else
|
||||
# error no OS layer setup
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/os_core.h"
|
||||
|
||||
#if OS_WINDOWS
|
||||
//# include "core/win32/os_core_win32.h"
|
||||
#elif OS_LINUX
|
||||
//# include "core/linux/os_core_linux.h"
|
||||
#else
|
||||
# error no OS layer setup
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user