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:
parent
77f745e1f0
commit
321187693c
2
Makefile
2
Makefile
@ -148,7 +148,7 @@ endif
|
|||||||
|
|
||||||
.PHONY : all debug release clean depend zip version force install uninstall
|
.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
|
CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/setup.o
|
||||||
|
|
||||||
all : $(BIN) $(CFGBIN)
|
all : $(BIN) $(CFGBIN)
|
||||||
|
|||||||
@ -32,12 +32,13 @@ static char *sep(char *path)
|
|||||||
char *realpath(const char *_path, char *resolved_path)
|
char *realpath(const char *_path, char *resolved_path)
|
||||||
{
|
{
|
||||||
int fd = open(".", O_RDONLY), l;
|
int fd = open(".", O_RDONLY), l;
|
||||||
|
char current_dir_path[PATH_MAX];
|
||||||
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
|
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
|
||||||
char tmp2[PATH_MAX];
|
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
getcwd(current_dir_path,PATH_MAX);
|
||||||
strncpy(path, _path, PATH_MAX);
|
strncpy(path, _path, PATH_MAX);
|
||||||
|
|
||||||
if (chdir(path)) {
|
if (chdir(path)) {
|
||||||
@ -79,7 +80,7 @@ char *realpath(const char *_path, char *resolved_path)
|
|||||||
|
|
||||||
strcat(resolved_path, tmp);
|
strcat(resolved_path, tmp);
|
||||||
abort:
|
abort:
|
||||||
fchdir(fd);
|
chdir(current_dir_path);
|
||||||
close(fd);
|
close(fd);
|
||||||
return resolved_path;
|
return resolved_path;
|
||||||
}
|
}
|
||||||
|
|||||||
7
struct.h
7
struct.h
@ -22,7 +22,12 @@
|
|||||||
#ifndef _STRUCT_H_
|
#ifndef _STRUCT_H_
|
||||||
#define _STRUCT_H_
|
#define _STRUCT_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#if defined(__BEOS__)
|
||||||
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
// Déclaration des types de base /////////////////////////////////////////////
|
// Déclaration des types de base /////////////////////////////////////////////
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user