cvsuser 04/10/07 02:24:25
Modified: src string.c
Log:
runtime prefix 3 - use prefix for ICU data
Revision Changes Path
1.226 +28 -10 parrot/src/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -w -r1.225 -r1.226
--- string.c 4 Oct 2004 18:20:05 -0000 1.225
+++ string.c 7 Oct 2004 09:24:24 -0000 1.226
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: string.c,v 1.225 2004/10/04 18:20:05 dan Exp $
+$Id: string.c,v 1.226 2004/10/07 09:24:24 leo Exp $
=head1 NAME
@@ -251,15 +251,33 @@
void * __ptr;
} __ptr_u;
+ if (!interpreter->parent_interpreter) {
/* DEFAULT_ICU_DATA_DIR is configured at build time, or it may be
set through the $PARROT_ICU_DATA_DIR environment variable. Need
a way to specify this via the command line as well. */
data_dir = Parrot_getenv("PARROT_ICU_DATA_DIR", &free_data_dir);
- if (data_dir == NULL)
- data_dir = const_cast(DEFAULT_ICU_DATA_DIR);
+ if (data_dir == NULL) {
+ const char *prefix;
+ char *p, *build_path;
+ build_path = data_dir = const_cast(DEFAULT_ICU_DATA_DIR);
+ /*
+ * if the installed --prefix directory exists then use it
+ */
+ prefix = Parrot_get_runtime_prefix(interpreter, NULL);
+ if (prefix) {
+ p = strstr(build_path, "blib"); /* .../blib/lib/... */
+ assert(p);
+ --p; /* slash or backslash */
+ data_dir = mem_sys_allocate(strlen(prefix) + strlen(p) + 1);
+ strcpy(data_dir, prefix);
+ strcat(data_dir, p);
+ free_data_dir = 1;
+ }
+ }
string_set_data_directory(data_dir);
if (free_data_dir)
mem_sys_free((void*)data_dir); /* cast away the constness */
+ }
/*
encoding_init();
chartype_init();