summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-09-23 21:30:35 -0700
committerJan Kotas <jkotas@microsoft.com>2015-09-23 21:30:35 -0700
commitdee3161cb612401c81d9f5f434910e46ad25bd1a (patch)
treec81c208944e869bccd2ee09d9e4bfadaa32867e5
parent57011c3b00e55343b95df632381c4b08fc8f5f9c (diff)
downloadcoreclr-dee3161cb612401c81d9f5f434910e46ad25bd1a.tar.gz
coreclr-dee3161cb612401c81d9f5f434910e46ad25bd1a.tar.bz2
coreclr-dee3161cb612401c81d9f5f434910e46ad25bd1a.zip
Fix crossgen command line handling on Unix
Replace hardcoded Windows directory and path separators with symbolic constants.
-rw-r--r--src/inc/palclr.h1
-rw-r--r--src/pal/inc/rt/palrt.h2
-rw-r--r--src/tools/crossgen/crossgen.cpp18
3 files changed, 12 insertions, 9 deletions
diff --git a/src/inc/palclr.h b/src/inc/palclr.h
index 9842bc4be6..26d882d08f 100644
--- a/src/inc/palclr.h
+++ b/src/inc/palclr.h
@@ -91,6 +91,7 @@
#define DIRECTORY_SEPARATOR_STR_W W("\\")
#define PATH_SEPARATOR_CHAR_W W(';')
+#define PATH_SEPARATOR_STR_W W(";")
// PAL Macros
// Not all compilers support fully anonymous aggregate types, so the
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index 92d9b3a219..b969047ce3 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -1364,11 +1364,13 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
#define DIRECTORY_SEPARATOR_CHAR_W W('/')
#define DIRECTORY_SEPARATOR_STR_W W("/")
#define PATH_SEPARATOR_CHAR_W W(':')
+#define PATH_SEPARATOR_STR_W W(":")
#else // PLATFORM_UNIX
#define DIRECTORY_SEPARATOR_CHAR_A '\\'
#define DIRECTORY_SEPARATOR_CHAR_W W('\\')
#define DIRECTORY_SEPARATOR_STR_W W("\\")
#define PATH_SEPARATOR_CHAR_W W(';')
+#define PATH_SEPARATOR_STR_W W(";")
#endif // PLATFORM_UNIX
#ifndef IMAGE_IMPORT_DESC_FIELD
diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp
index 192f6b1bf8..9bdfdd7294 100644
--- a/src/tools/crossgen/crossgen.cpp
+++ b/src/tools/crossgen/crossgen.cpp
@@ -282,7 +282,7 @@ bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DW
{
LPWSTR wszTrustedPathCopy = new WCHAR[wcslen(pwzTrustedPlatformAssemblies) + 1];
wcscpy_s(wszTrustedPathCopy, wcslen(pwzTrustedPlatformAssemblies) + 1, pwzTrustedPlatformAssemblies);
- LPWSTR wszSingleTrustedPath = wcstok(wszTrustedPathCopy, W(";"));
+ LPWSTR wszSingleTrustedPath = wcstok(wszTrustedPathCopy, PATH_SEPARATOR_STR_W);
while (wszSingleTrustedPath != NULL)
{
@@ -294,12 +294,12 @@ bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DW
wszSingleTrustedPath++;
}
- if (StringEndsWith(wszSingleTrustedPath, W("\\mscorlib.dll")) ||
- StringEndsWith(wszSingleTrustedPath, W("\\mscorlib.ni.dll")))
+ if (StringEndsWith(wszSingleTrustedPath, DIRECTORY_SEPARATOR_STR_W W("mscorlib.dll")) ||
+ StringEndsWith(wszSingleTrustedPath, DIRECTORY_SEPARATOR_STR_W W("mscorlib.ni.dll")))
{
wcscpy_s(pwzMscorlibPath, cbMscorlibPath, wszSingleTrustedPath);
- LPWSTR pwzSeparator = wcsrchr(pwzMscorlibPath, W('\\'));
+ LPWSTR pwzSeparator = wcsrchr(pwzMscorlibPath, DIRECTORY_SEPARATOR_CHAR_W);
if (pwzSeparator == NULL)
{
delete [] wszTrustedPathCopy;
@@ -311,7 +311,7 @@ bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DW
return true;
}
- wszSingleTrustedPath = wcstok(NULL, W(";"));
+ wszSingleTrustedPath = wcstok(NULL, PATH_SEPARATOR_STR_W);
}
delete [] wszTrustedPathCopy;
@@ -370,7 +370,7 @@ void PopulateTPAList(SString path, LPCWSTR pwszMask, SString &refTPAList, bool f
if (fAddDelimiter)
{
// Add the path delimiter if we already have entries in the TPAList
- refTPAList.Append(W(";"));
+ refTPAList.Append(PATH_SEPARATOR_CHAR_W);
}
// Add the path to the TPAList
refTPAList.Append(path);
@@ -400,7 +400,7 @@ void ComputeTPAListFromPlatformAssembliesPath(LPCWSTR pwzPlatformAssembliesPaths
while (itr != end)
{
start = itr;
- BOOL found = ssPlatformAssembliesPath.Find(itr, W(';'));
+ BOOL found = ssPlatformAssembliesPath.Find(itr, PATH_SEPARATOR_CHAR_W);
if (!found)
{
itr = end;
@@ -417,9 +417,9 @@ void ComputeTPAListFromPlatformAssembliesPath(LPCWSTR pwzPlatformAssembliesPaths
if (len > 0)
{
- if (qualifiedPath[len-1]!='\\')
+ if (qualifiedPath[len-1]!=DIRECTORY_SEPARATOR_CHAR_W)
{
- qualifiedPath.Append('\\');
+ qualifiedPath.Append(DIRECTORY_SEPARATOR_CHAR_W);
}
// Enumerate the EXE/DLL modules within this path and add them to the TPAList