1
/* Copyright (C) 2000 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
#include "mysys_priv.h"
19
/* Returns full load-path for a file. to may be = path */
20
/* if path is a hard-path return path */
21
/* if path starts with home-dir return path */
22
/* if path starts with current dir or parent-dir unpack path */
23
/* if there is no path, prepend with own_path_prefix if given */
24
/* else unpack path according to current dir */
26
char * my_load_path(char * to, const char *path,
27
const char *own_path_prefix)
31
DBUG_ENTER("my_load_path");
32
DBUG_PRINT("enter",("path: %s prefix: %s",path,
33
own_path_prefix ? own_path_prefix : ""));
35
if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
36
test_if_hard_path(path))
37
VOID(strmov(buff,path));
38
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
39
(is_prefix(path,FN_PARENTDIR)) ||
43
is_cur=2; /* Remove current dir */
44
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
45
VOID(strcat(buff,path+is_cur));
47
VOID(strmov(buff,path)); /* Return org file name */
50
VOID(strxmov(buff,own_path_prefix,path,NullS));
52
DBUG_PRINT("exit",("to: %s",to));