Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/eclipseUtil.c')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseUtil.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c b/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c
index 8845dbc69..9ed7b68b2 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseUtil.c
@@ -133,20 +133,27 @@ _TCHAR * checkPathList( _TCHAR* pathList, _TCHAR* programDir, int reverseOrder)
return result;
}
-_TCHAR * concatStrings(_TCHAR** strs) {
+_TCHAR * concatStrings(_TCHAR**strs) {
+ return concatPaths(strs, 0);
+}
+
+_TCHAR * concatPaths(_TCHAR** strs, _TCHAR separator) {
+ _TCHAR separatorString[] = { separator, 0 };
_TCHAR * result;
int i = -1;
size_t length = 0;
/* first count how large a buffer we need */
- while( strs[++i] != NULL) {
- length += _tcslen(strs[i]);
+ while (strs[++i] != NULL) {
+ length += _tcslen(strs[i]) + (separator != 0 ? 1 : 0);
}
-
+
result = malloc((length + 1) * sizeof(_TCHAR));
result[0] = 0;
i = -1;
- while(strs[++i] != NULL) {
+ while (strs[++i] != NULL) {
result = _tcscat(result, strs[i]);
+ if (separator != 0)
+ result = _tcscat(result, separatorString);
}
return result;
}

Back to the top