Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation on Haiku OS #47

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rott/dosutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void DisplayTextSplash(byte *text, int l)
printf ("\033[m");
}

#if !defined(__CYGWIN__) && !defined(__MINGW32__)
#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__HAIKU__)
#include <execinfo.h>

void print_stack (int level)
Expand Down
14 changes: 14 additions & 0 deletions rott/rt_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "SDL.h"

#ifdef __HAIKU__
#include <libgen.h>
#include <unistd.h>
#endif

#include "rt_actor.h"
#include "rt_stat.h"
#include "rt_vid.h"
Expand Down Expand Up @@ -149,6 +154,15 @@ extern void RecordDemoQuery ( void );
int main (int argc, char *argv[])
{
extern char *BATTMAPS, *ROTTMAPS;
#ifdef __HAIKU__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? We only read/write files from/to ApogeePath, i.e. the result of GetPrefDir(), and only read files from the paths returned by FindFileByName(). Does any of these functions not work for you? If that's the case, I'd say we should go and fix it there instead of changing the directory to the executable just for Haiku.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, this was a change applied to my sourceport fork because I was opening WADs from the executable's directory. In your sourceport it shouldn't be necessary. I'll remove it.

char *binpath = realpath(argv[0], NULL);
if (binpath != NULL)
{
chdir(dirname(binpath));
free(binpath);
}
#endif

_argc = argc;
_argv = argv;

Expand Down