JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
1.97k stars 606 forks source link

Unix: Fix argv[0] getting overwritten on launch #1183

Closed Daggolin closed 7 months ago

Daggolin commented 8 months ago

Calling Sys_Dirname on argv[0] lead to slashes in argv[0] getting overwritten on Linux (and potentially other non-Windows platforms), causing some external script to fail sending signals to the right process, because the path changed.

This pull request adjusts Sys_Dirname and Sys_Basename to work with a copy of the given string instead of the original. This makes the behavior of both functions more consistent between Windows and other platforms.