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:
44
files.c
44
files.c
@@ -24,7 +24,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -72,49 +71,6 @@ int Determiner_repertoire_courant(void)
|
||||
return (getcwd(Principal_Repertoire_courant,256)==NULL);
|
||||
}
|
||||
|
||||
|
||||
int Repertoire_existe(char * Repertoire)
|
||||
// Détermine si un répertoire passé en paramètre existe ou non dans le
|
||||
// répertoire courant.
|
||||
{
|
||||
DIR* Enreg; // Structure de lecture des éléments
|
||||
|
||||
if (strcmp(Repertoire,"..")==0)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
// On va chercher si le répertoire existe à l'aide d'un Opendir. S'il
|
||||
// renvoie NULL c'est que le répertoire n'est pas accessible...
|
||||
|
||||
Enreg=opendir(Repertoire);
|
||||
if (Enreg==NULL)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
closedir(Enreg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Fichier_existe(char * Fichier)
|
||||
// Détermine si un fichier passé en paramètre existe ou non dans le
|
||||
// répertoire courant.
|
||||
{
|
||||
struct stat buf;
|
||||
int Resultat;
|
||||
|
||||
Resultat=stat(Fichier,&buf);
|
||||
if (Resultat!=0)
|
||||
return(errno!=ENOENT);
|
||||
else
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Conventions:
|
||||
//
|
||||
// * Le fileselect modifie le répertoire courant. Ceci permet de n'avoir
|
||||
|
||||
Reference in New Issue
Block a user