Fix path detection on Haiku
This commit is contained in:
parent
15ba54eb77
commit
951f58445c
@ -118,7 +118,7 @@ Copyright 2010 Fernando Mastandrea (masta.uy)
|
||||
Copyright 2008-2009 Peter Gordon
|
||||
Copyright 2008-2012 Franck Charlet
|
||||
Copyright 2008-2020 Yves Rizoud
|
||||
Copyright 2007-2020 Adrien Destugues
|
||||
Copyright 2007-2021 Adrien Destugues
|
||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
||||
|
||||
GNU GPL version 2.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
*/
|
||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||
|
||||
Copyright 2007 Adrien Destugues
|
||||
Copyright 2007-2021 Adrien Destugues
|
||||
|
||||
Grafx2 is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
@ -26,8 +26,10 @@
|
||||
#ifdef __HAIKU__
|
||||
#include <Clipboard.h>
|
||||
#include <Entry.h>
|
||||
#include <image.h>
|
||||
#include <Volume.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "haiku.h"
|
||||
@ -57,4 +59,16 @@ char* haiku_get_clipboard()
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* haiku_get_app_path()
|
||||
{
|
||||
static image_info info;
|
||||
static int32 cookie = 0;
|
||||
|
||||
if (cookie == 0) do {
|
||||
get_next_image_info(B_CURRENT_TEAM, &cookie, &info);
|
||||
} while (info.type != B_APP_IMAGE);
|
||||
|
||||
return info.name;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -31,6 +31,7 @@ extern "C" {
|
||||
#endif
|
||||
qword haiku_get_free_space(char* path);
|
||||
char* haiku_get_clipboard();
|
||||
const char* haiku_get_app_path();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -137,6 +137,8 @@ char * Get_program_directory(const char * argv0)
|
||||
}
|
||||
else
|
||||
program_dir = Extract_path(NULL, argv0);
|
||||
#elif defined(__HAIKU__)
|
||||
program_dir = Extract_path(NULL, haiku_get_app_path());
|
||||
|
||||
// Others: The part of argv[0] before the executable name.
|
||||
// Keep the last \ or /.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user