Fix more things for Haiku port

* Add an icon in the native format
* Add "resource definition" to the executable (including icon and version info)
* Use the proper API to find the share directory.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2126 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2015-08-16 12:27:21 +00:00
parent 2f3c55477e
commit f2797f6648
4 changed files with 70 additions and 18 deletions

BIN
misc/haiku/grafx2.icon Normal file

Binary file not shown.

View File

@ -544,6 +544,11 @@ ziprelease: version $(BIN) release
$(BIN) : $(OBJ)
test -d ../bin || $(MKDIR) ../bin
$(CC) $(OBJ) -o $(BIN) $(LOPT) $(LFLAGS)
ifeq ($(PLATFORM),Haiku)
rc -o $(OBJDIR)/grafx2.rsrc grafx2.rdef
xres -o $(BIN) $(OBJDIR)/grafx2.rsrc
mimeset -f $(BIN)
endif
# SVN revision number
version.c :

45
src/grafx2.rdef Normal file
View File

@ -0,0 +1,45 @@
resource vector_icon array {
$"6E6369660705000300FFFF036E0070020006023EEB4C3EBC16BEBC163EEB4C4B"
$"486546B13B0005AAFFFF0422B8020102023F30000000000000003F0000488000"
$"48C000FF04FCFFFF0080FFEB0005FF02010202BECF30AFF9E52FA1B2BE90DF4B"
$"0DC74AD26C004D037C00FF73096FFF0C0A1020203420402C4C20602060345440"
$"604C60604C60405434602060204C2C4020340A06B3BEB3D33522382626262638"
$"22350A065E224C22402E43314E265A260A06B3CB5EB3CB4C2E403143264E265A"
$"0A04B5532A2A2A2A2EB5532E0A042A2E2E2E2E322A320A042A362E362E3A2A3A"
$"0A0432B54636B546362A322A0A04322E362E36323232060FFFAFAA3FC2A9C2C4"
$"C38CC1E5C1C6C3A4C2A9C5EDC1C6C50EC2A9C5EDC332C567C332C567C29BC4D2"
$"C332C34BC29BC3E0C3CAC2B6C557C34BC4C0C2B6C597C38AC5C5C428C5BBC3D8"
$"C5C5C428C5C5C8FBC66AC99D51C982C77CC890C9A1C674C918C5ED51C87451C8"
$"74C682C6FF51C413C687C589C676C399C5E0C2C4C640C322C4FDC1E50637FFAA"
$"FEFFAAAAAAAAA86A86FAAB3FB771C442B771C442B663C551B771C816B663C707"
$"B880C924BB45C816BA36C924BBE5C776BC09C5CABC26C69BBC09C5CABCCCC68E"
$"BD2EC62CBB45C442BA1FC568BA81C5CABB38C513BB38C513BBB6C5E7BAE3C7B4"
$"BB99C6FDBA0AC88CB7D3C7B4B8ACC88CB6FBC6DCB7D3C4A4B6FBC57DB7D3C4A4"
$"BB45C133BB45C133BBB1C0C7BCCCC133BC60C0C7BD39C19FBCCCC2BBBD39C24F"
$"BCCCC2BBBC09C37FBDF2C568BE54C506BD07C3B9BF63C3F7C102C259BF7AC0D1"
$"C102BF4947C0D1C411BF49473BC3AFBC9CC34DBC3AC228BD60C0A0BBD8C214BA"
$"64C523C523BE37C5ADBDAEC5ADBA64C8F7BA64C980B9DAC5ADB9DAB607C523B6"
$"91B9DAC1DABFDCBBD8C34DBF4947C00DC03E3BC03E3BBF9CBD1FBDF23BBE94BD"
$"1FBD50BE64BDF2C00DBD50BF6BBDF2C00DC03EC259BF2FC368BD1CC32FBD2EC3"
$"1DBD2EC31DBDD1C27ABD2EC0D1BDD1C173BC8CC02FBAE3C0D1BB85C02FBAE3C0"
$"D10A042AB5532EB5532E2A2A2A080A030100000A02010102BFFFFC3098AAB098"
$"AABFFFFC4BFEDD4BFEF20A01070401050607080B000A0501091001158200040A"
$"05010A1001178110040A04020203000A000100100217830004157F00040A0602"
$"030202C0000018ED4E98ED4EC000004C00004BFFFF"
};
resource app_signature "application/x-vnd.GrafX2";
resource app_version {
major = 2,
middle = 5,
minor = 2126,
variety = B_APPV_BETA,
internal = 0,
short_info = "GrafX2",
long_info = "The ultimate 256-color painting program"
};

View File

@ -127,17 +127,18 @@ void Set_data_directory(const char * program_dir, char * data_dir)
// On MacOSX, it is stored in a special folder:
#if defined(__macosx__)
strcat(data_dir,"Contents/Resources/");
// On GP2X, executable is not in bin/
#elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) || defined(__ANDROID__)
// On GP2X, AROS and Android, executable is not in bin/
#elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) || defined(GCWZERO) || defined(__AROS__) || defined(__ANDROID__)
strcat(data_dir,"share/grafx2/");
//on tos the same directory
//on tos, the same directory is used for everything
#elif defined (__MINT__)
strcpy(data_dir, program_dir);
// Haiku provides us with an API to find it.
#elif defined(__HAIKU__)
if (find_path(Set_data_directory, B_FIND_PATH_DATA_DIRECTORY, "grafx2", data_dir, PATH_MAX) != B_OK)
strcat(data_dir,"../data/grafx2/");
// All other targets, program is in a "bin" subdirectory
#elif defined (__AROS__)
strcat(data_dir,"share/grafx2/");
#elif defined (GCWZERO)
strcat(data_dir,"share/grafx2/");
#else
strcat(data_dir,"../share/grafx2/");
#endif
@ -156,7 +157,7 @@ void Set_data_directory(const char * program_dir, char * data_dir)
// OUT: Write into config_dir. Trailing / or \ is kept.
void Set_config_directory(const char * program_dir, char * config_dir)
{
// AmigaOS4
// AmigaOS4 provides the PROGIR: alias to the directory where the executable is.
#if defined(__amigaos4__) || defined(__AROS__)
strcpy(config_dir,"PROGDIR:");
// GP2X
@ -164,20 +165,21 @@ void Set_config_directory(const char * program_dir, char * config_dir)
// On the GP2X, the program is installed to the sdcard, and we don't want to mess with the system tree which is
// on an internal flash chip. So, keep these settings locals.
strcpy(config_dir,program_dir);
#elif defined(__MINT__)
// For TOS we store everything in the program dir
#elif defined(__MINT__)
strcpy(config_dir,program_dir);
// For all other platforms, there is some kind of settigns dir to store this.
#else
char filename[MAX_PATH_CHARACTERS];
#ifdef GCWZERO
strcpy(config_dir, "/media/home/.grafx2/");
#else
// In priority: check root directory
strcpy(config_dir, program_dir);
#endif
#ifdef GCWZERO
strcpy(config_dir, "/media/home/.grafx2/");
#else
// In priority: check root directory
strcpy(config_dir, program_dir);
#endif
// On all the remaining targets except OSX, the executable is in ./bin
#if !defined(__macosx__)
strcat(config_dir, "../");
strcat(config_dir, "../");
#endif
strcpy(filename, config_dir);
strcat(filename, CONFIG_FILENAME);
@ -207,7 +209,7 @@ void Set_config_directory(const char * program_dir, char * config_dir)
printf("GFX2.CFG not found in %s\n",filename);
strcpy(config_parent_dir, config_dir);
#else
// "~/.grafx2"
// "~/.grafx2"
const char* Config_SubDir = ".grafx2";
config_parent_dir = getenv("HOME");
#endif