1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Support alternate database locations.

This commit is contained in:
Thomas G. Lockhart
1997-11-07 06:38:51 +00:00
parent d98f2f9985
commit 7d1f2f8a27
8 changed files with 273 additions and 254 deletions

View File

@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Id: fd.c,v 1.26 1997/09/18 20:21:24 momjian Exp $
* $Id: fd.c,v 1.27 1997/11/07 06:38:15 thomas Exp $
*
* NOTES:
*
@ -125,8 +125,6 @@ static Size SizeVfdCache = 0;
*/
static int nfile = 0;
static char Sep_char = '/';
/*
* Private Routines
*
@ -458,23 +456,25 @@ FreeVfd(File file)
VfdCache[0].nextFree = file;
}
/* filepath()
* Open specified file name.
* Fill in absolute path fields if necessary.
*
* Modify to use GetDatabasePath() rather than hardcoded paths.
* - thomas 1997-11-02
*/
static char *
filepath(char *filename)
{
char *buf;
char basename[16];
int len;
if (*filename != Sep_char)
/* Not an absolute path name? Then fill in with database path... */
if (*filename != SEP_CHAR)
{
/* Either /base/ or \base\ */
sprintf(basename, "%cbase%c", Sep_char, Sep_char);
len = strlen(DataDir) + strlen(basename) + strlen(GetDatabaseName())
+ strlen(filename) + 2;
len = strlen(GetDatabasePath()) + strlen(filename) + 2;
buf = (char *) palloc(len);
sprintf(buf, "%s%s%s%c%s",
DataDir, basename, GetDatabaseName(), Sep_char, filename);
sprintf(buf, "%s%c%s", GetDatabasePath(), SEP_CHAR, filename);
}
else
{
@ -482,6 +482,10 @@ filepath(char *filename)
strcpy(buf, filename);
}
#ifdef FILEDEBUG
printf("filepath: path is %s\n", buf);
#endif
return (buf);
}