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-2009 Peter Gordon
|
||||||
Copyright 2008-2012 Franck Charlet
|
Copyright 2008-2012 Franck Charlet
|
||||||
Copyright 2008-2020 Yves Rizoud
|
Copyright 2008-2020 Yves Rizoud
|
||||||
Copyright 2007-2020 Adrien Destugues
|
Copyright 2007-2021 Adrien Destugues
|
||||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
||||||
|
|
||||||
GNU GPL version 2.
|
GNU GPL version 2.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* 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
|
Grafx2 is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
@ -26,8 +26,10 @@
|
|||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
|
#include <image.h>
|
||||||
#include <Volume.h>
|
#include <Volume.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "haiku.h"
|
#include "haiku.h"
|
||||||
@ -57,4 +59,16 @@ char* haiku_get_clipboard()
|
|||||||
}
|
}
|
||||||
return NULL;
|
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
|
#endif
|
||||||
|
|||||||
@ -31,6 +31,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
qword haiku_get_free_space(char* path);
|
qword haiku_get_free_space(char* path);
|
||||||
char* haiku_get_clipboard();
|
char* haiku_get_clipboard();
|
||||||
|
const char* haiku_get_app_path();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -137,6 +137,8 @@ char * Get_program_directory(const char * argv0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
program_dir = Extract_path(NULL, argv0);
|
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.
|
// Others: The part of argv[0] before the executable name.
|
||||||
// Keep the last \ or /.
|
// Keep the last \ or /.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user