+/* Returns the path to icu/source/test/testdata/ */
+const char *getSourceTestData() {
+ const char *srcDataDir = NULL;
+#ifdef U_TOPSRCDIR
+ srcDataDir = U_TOPSRCDIR U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING;
+#else
+ srcDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING;
+ FILE *f = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING"rbbitst.txt", "r");
+
+ if (f != NULL) {
+ /* We're in icu/source/test/letest/ */
+ fclose(f);
+ } else {
+ /* We're in icu/source/test/letest/(Debug|Release) */
+ srcDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING;
+ }
+#endif
+
+ return srcDataDir;
+}
+
+const char *getPath(char buffer[2048], const char *filename) {
+ const char *testDataDirectory = getSourceTestData();
+
+ strcpy(buffer, testDataDirectory);
+ strcat(buffer, filename);
+
+ return buffer;
+}
+