Fixes realpath for beos uses. As beos also misses fchdir...

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@423 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-12-27 13:57:53 +00:00
parent 77f745e1f0
commit 321187693c
3 changed files with 10 additions and 4 deletions

View File

@ -148,7 +148,7 @@ endif
.PHONY : all debug release clean depend zip version force install uninstall
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o
CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/setup.o
all : $(BIN) $(CFGBIN)

View File

@ -32,12 +32,13 @@ static char *sep(char *path)
char *realpath(const char *_path, char *resolved_path)
{
int fd = open(".", O_RDONLY), l;
char current_dir_path[PATH_MAX];
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
char tmp2[PATH_MAX];
if (fd < 0) {
return NULL;
}
getcwd(current_dir_path,PATH_MAX);
strncpy(path, _path, PATH_MAX);
if (chdir(path)) {
@ -79,7 +80,7 @@ char *realpath(const char *_path, char *resolved_path)
strcat(resolved_path, tmp);
abort:
fchdir(fd);
chdir(current_dir_path);
close(fd);
return resolved_path;
}

View File

@ -22,7 +22,12 @@
#ifndef _STRUCT_H_
#define _STRUCT_H_
#include <stdint.h>
#if defined(__BEOS__)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#include "const.h"
// Déclaration des types de base /////////////////////////////////////////////