Fixed path length sent to proc_pidpath because it seems to expect a maximum path length which was previously exceeded. Opening 4coder now works from anywhere.

This commit is contained in:
Yuval Dolev 2020-01-19 05:30:04 +02:00
parent 63b964f1c5
commit b255da9d00
2 changed files with 7 additions and 6 deletions

View File

@ -952,13 +952,13 @@ mac_toggle_fullscreen(void){
float dx = event.scrollingDeltaX; float dx = event.scrollingDeltaX;
float dy = event.scrollingDeltaY; float dy = event.scrollingDeltaY;
i8 scroll_speed = 0; i8 wheel_delta = 0;
if (dy > 0){ if (dy > 0){
scroll_speed = -100; wheel_delta = -100;
} else if (dy < 0){ } else if (dy < 0){
scroll_speed = 100; wheel_delta = 100;
} }
mac_vars.input_chunk.trans.mouse_wheel = scroll_speed; mac_vars.input_chunk.trans.mouse_wheel = wheel_delta;
system_signal_step(0); system_signal_step(0);
} }

View File

@ -29,12 +29,12 @@ system_get_path_sig(){
{ {
local_persist b32 has_stashed_4ed_path = false; local_persist b32 has_stashed_4ed_path = false;
if (!has_stashed_4ed_path){ if (!has_stashed_4ed_path){
local_const i32 binary_path_capacity = KB(32); local_const u32 binary_path_capacity = PATH_MAX;
u8 *memory = (u8*)system_memory_allocate(binary_path_capacity, file_name_line_number_lit_u8); u8 *memory = (u8*)system_memory_allocate(binary_path_capacity, file_name_line_number_lit_u8);
pid_t pid = getpid(); pid_t pid = getpid();
i32 size = proc_pidpath(pid, memory, binary_path_capacity); i32 size = proc_pidpath(pid, memory, binary_path_capacity);
Assert(size <= binary_path_capacity - 1); Assert(size < binary_path_capacity);
mac_vars.binary_path = SCu8(memory, size); mac_vars.binary_path = SCu8(memory, size);
mac_vars.binary_path = string_remove_last_folder(mac_vars.binary_path); mac_vars.binary_path = string_remove_last_folder(mac_vars.binary_path);
@ -742,6 +742,7 @@ function void*
mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){ mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){
u64 adjusted_size = size + ALLOCATION_SIZE_ADJUSTMENT; u64 adjusted_size = size + ALLOCATION_SIZE_ADJUSTMENT;
void *memory = mmap(base, adjusted_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); void *memory = mmap(base, adjusted_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
Assert(memory != MAP_FAILED);
Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)memory; Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)memory;