BIG change in directory handling:

- Unix users can "make install" and "make uninstall" (as root).
- Installation creates shortcuts "grafx2" and "gfx2cfg" in /usr/local/bin
- Installation puts data files (icon GIFs, gfx2.dat,..) and the actual binaries in /usr/local/share/grafx2
- At runtime, the programs search and create configuration files (gfx2.cfg and gfx2.ini) in ~/.grafx2
(But if there are some present in program's own directory, they override)
- Uninstall removes programs and data, but leaves all users' configurations.

Win32: User's config directory is %APPDATA%\GrafX2
Win98: %APPDATA% is not set by default, so the program falls back to executable's directory.

Tested on Debian Linux
Partially tested on Win XP (early version)
Tested on Win98


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@365 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2008-11-28 23:50:28 +00:00
parent 3d4def25f0
commit ff27c5dcf9
19 changed files with 386 additions and 143 deletions

17
main.c
View File

@@ -32,7 +32,6 @@
#include "moteur.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
@@ -48,6 +47,7 @@
#include "saveini.h"
#include "io.h"
#include "texte.h"
#include "setup.h"
#if defined(__WIN32__)
#include <windows.h>
@@ -246,6 +246,7 @@ void Initialisation_du_programme(int argc,char * argv[])
{
int Temp;
int Mode_dans_lequel_on_demarre;
char Repertoire_du_programme[TAILLE_CHEMIN_FICHIER];
// On crée dès maintenant les descripteurs des listes de pages pour la page
// principale et la page de brouillon afin que leurs champs ne soient pas
@@ -256,9 +257,13 @@ void Initialisation_du_programme(int argc,char * argv[])
Initialiser_S_Liste_de_pages(Principal_Backups);
Initialiser_S_Liste_de_pages(Brouillon_Backups);
// On détermine dès le départ où se trouve le fichier:
Chercher_repertoire_du_programme(argv[0]);
// Determine the executable directory
Set_Program_Directory(argv[0],Repertoire_du_programme);
// Choose directory for data (read only)
Set_Data_Directory(Repertoire_du_programme,Repertoire_des_donnees);
// Choose directory for settings (read/write)
Set_Config_Directory(Repertoire_du_programme,Repertoire_de_configuration);
// On détecte les lecteurs qui sont accessibles:
Rechercher_drives();
// On détermine le répertoire courant:
@@ -333,9 +338,9 @@ void Initialisation_du_programme(int argc,char * argv[])
SDL_WM_SetCaption("GrafX2 beta "POURCENTAGE_VERSION" - USE AT YOUR OWN RISK","GrafX2");
{
// Routine pour définir l'icone.
char Chemin_icone[256];
char Chemin_icone[TAILLE_CHEMIN_FICHIER];
SDL_Surface * Icone;
sprintf(Chemin_icone, "%s%s", Repertoire_du_programme, "gfx2.gif");
sprintf(Chemin_icone, "%s%s", Repertoire_des_donnees, "gfx2.gif");
Icone = IMG_Load(Chemin_icone);
if (Icone)
{