Printf debugging the .so search; fixed file truncation bug
This commit is contained in:
parent
a510ae5dce
commit
0ae7987cec
|
@ -42,9 +42,11 @@ get_full_path(Arena *arena, Path_Search_List *search_list, String_Const_u8 relat
|
|||
u8 *path_base = relative_base - node_size;
|
||||
block_copy(path_base, node->string.str, node_size);
|
||||
String_Const_u8 name = SCu8(path_base, opl);
|
||||
printf("get_full_path: trying %.*s\n", string_expand(name));
|
||||
File_Attributes attribs = system_quick_file_attributes(arena, name);
|
||||
if (attribs.size > 0){
|
||||
result = name;
|
||||
printf("hit\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1666,7 +1666,7 @@ main(int argc, char **argv){
|
|||
char custom_fail_version_msg[] = "Failed to load custom code due to a version mismatch. Try rebuilding with buildsuper.";
|
||||
char custom_fail_init_apis[] = "Failed to load custom code due to missing 'init_apis' symbol. Try rebuilding with buildsuper";
|
||||
|
||||
Scratch_Block scratch(&linuxvars.tctx, Scratch_Share);
|
||||
Scratch_Block scratch(&linuxvars.tctx);
|
||||
String_Const_u8 default_file_name = string_u8_litexpr("custom_4coder.so");
|
||||
Path_Search_List search_list = {};
|
||||
search_list_add_system_path(scratch, &search_list, SystemPath_CurrentDirectory);
|
||||
|
|
|
@ -212,7 +212,7 @@ system_save_file(Arena* scratch, char* file_name, String_Const_u8 data){
|
|||
|
||||
// TODO(inso): should probably put a \n on the end if it's a text file.
|
||||
|
||||
int fd = open(file_name, O_WRONLY|O_CREAT, 0666);
|
||||
int fd = open(file_name, O_TRUNC|O_WRONLY|O_CREAT, 0666);
|
||||
if (fd != -1) {
|
||||
int bytes_written = write(fd, data.str, data.size);
|
||||
if (bytes_written == -1) {
|
||||
|
|
Loading…
Reference in New Issue