From 488e6a16685241ed1aed3b3d386b78ed32e428f0 Mon Sep 17 00:00:00 2001 From: "John Chen (JOCHEN7)" Date: Tue, 23 Feb 2016 20:36:07 -0800 Subject: Support long paths in CoreCLR runtime on Windows The CoreCLR runtime is updated to support long file paths on Windows. Pending updates to mscorlib.dll, the following scenarios are supported: * Run managed apps from a long path. * Load CoreCLR runtime and framework from a long path. * Load user assemblies from a long path. * Run CrossGen from a long path, with its input/output from a long path. * Generate debug log file at a long path. The following scenarios are not yet supported, and will be fixed in future commits: * Mscorlib.dll and framework assemblies are not yet long path compatible. Note that until mscorlib.dll is fixed, most of the runtime changes can't actually be used. * Support on non-Windows platforms. * Support for debugging and error reporting. * Tools such as ilasm or ildasm. --- src/tools/crossgen/crossgen.cpp | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) (limited to 'src/tools') diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp index 973e775a03..16a2819511 100644 --- a/src/tools/crossgen/crossgen.cpp +++ b/src/tools/crossgen/crossgen.cpp @@ -464,7 +464,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) LPCWSTR pwzAppNiPaths = nullptr; LPCWSTR pwzPlatformAssembliesPaths = nullptr; LPCWSTR pwzPlatformWinmdPaths = nullptr; - WCHAR wzDirectoryToStorePDB[MAX_LONGPATH] = W("\0"); + StackSString wzDirectoryToStorePDB; bool fCreatePDB = false; bool fGeneratePDBLinesInfo = false; LPWSTR pwzSearchPathForManagedPDB = NULL; @@ -696,28 +696,14 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) dwFlags = dwFlags & ~(NGENWORKER_FLAGS_FULLTRUSTDOMAIN | NGENWORKER_FLAGS_READYTORUN); // Parse: - if (wcscpy_s( - wzDirectoryToStorePDB, - _countof(wzDirectoryToStorePDB), - argv[0]) != 0) - { - Output(W("Unable to parse output directory to store PDB")); - exit(FAILURE_RESULT); - } + wzDirectoryToStorePDB.Set(argv[0]); argv++; argc--; // Ensure output dir ends in a backslash, or else diasymreader has issues - if (wzDirectoryToStorePDB[wcslen(wzDirectoryToStorePDB)-1] != DIRECTORY_SEPARATOR_CHAR_W) + if (wzDirectoryToStorePDB[wzDirectoryToStorePDB.GetCount()-1] != DIRECTORY_SEPARATOR_CHAR_W) { - if (wcscat_s( - wzDirectoryToStorePDB, - _countof(wzDirectoryToStorePDB), - DIRECTORY_SEPARATOR_STR_W) != 0) - { - Output(W("Unable to parse output directory to store PDB")); - exit(FAILURE_RESULT); - } + wzDirectoryToStorePDB.Append(DIRECTORY_SEPARATOR_STR_W); } if (argc == 0) @@ -773,28 +759,14 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) dwFlags = dwFlags & ~NGENWORKER_FLAGS_READYTORUN; // Parse: - if (wcscpy_s( - wzDirectoryToStorePDB, - _countof(wzDirectoryToStorePDB), - argv[0]) != 0) - { - Output(W("Unable to parse output directory to store perfmap")); - exit(FAILURE_RESULT); - } + wzDirectoryToStorePDB.Set(argv[0]); argv++; argc--; // Ensure output dir ends in a backslash if (wzDirectoryToStorePDB[wcslen(wzDirectoryToStorePDB)-1] != DIRECTORY_SEPARATOR_CHAR_W) { - if (wcscat_s( - wzDirectoryToStorePDB, - _countof(wzDirectoryToStorePDB), - DIRECTORY_SEPARATOR_STR_W) != 0) - { - Output(W("Unable to parse output directory to store perfmap")); - exit(FAILURE_RESULT); - } + wzDirectoryToStorePDB.Append(DIRECTORY_SEPARATOR_STR_W); } if (argc == 0) -- cgit v1.2.3