diff options
author | John Chen (JOCHEN7) <jochen@microsoft.com> | 2016-02-23 20:36:07 -0800 |
---|---|---|
committer | John Chen (JOCHEN7) <jochen@microsoft.com> | 2016-02-29 13:55:49 -0800 |
commit | 488e6a16685241ed1aed3b3d386b78ed32e428f0 (patch) | |
tree | 9fd979bdde69b08216c6dde6a466fa3ff519c775 /src/utilcode/splitpath.cpp | |
parent | 2d98b6a53263b9ad4b98e4a5dee35e703fd7ddf5 (diff) | |
download | coreclr-488e6a16685241ed1aed3b3d386b78ed32e428f0.tar.gz coreclr-488e6a16685241ed1aed3b3d386b78ed32e428f0.tar.bz2 coreclr-488e6a16685241ed1aed3b3d386b78ed32e428f0.zip |
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.
Diffstat (limited to 'src/utilcode/splitpath.cpp')
-rw-r--r-- | src/utilcode/splitpath.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/utilcode/splitpath.cpp b/src/utilcode/splitpath.cpp index 927e8828e1..f7a35fdd97 100644 --- a/src/utilcode/splitpath.cpp +++ b/src/utilcode/splitpath.cpp @@ -124,7 +124,7 @@ void SplitPathInterior( /* extract drive letter and :, if any */ - if ((wcslen(wszPath) >= (_MAX_DRIVE - 2)) && (*(wszPath + _MAX_DRIVE - 2) == _T(':'))) { + if ((wcslen(wszPath) > (_MAX_DRIVE - 2)) && (*(wszPath + _MAX_DRIVE - 2) == _T(':'))) { if (pwszDrive && pcchDrive) { *pwszDrive = wszPath; *pcchDrive = _MAX_DRIVE - 1; @@ -243,38 +243,25 @@ void SplitPath(__in SString const &path, __inout_opt SString *fname, __inout_opt SString *ext) { - LPWSTR wzDrive = NULL; - if (drive != NULL) - wzDrive = drive->OpenUnicodeBuffer(_MAX_DRIVE); - - LPWSTR wzDir = NULL; - if (dir != NULL) - wzDir = dir->OpenUnicodeBuffer(_MAX_DIR); - - LPWSTR wzFname = NULL; - if (fname != NULL) - wzFname = fname->OpenUnicodeBuffer(_MAX_FNAME); - - LPWSTR wzExt = NULL; - if (ext != NULL) - wzExt = ext->OpenUnicodeBuffer(_MAX_EXT); + LPCWSTR wzDrive, wzDir, wzFname, wzExt; + size_t cchDrive, cchDir, cchFname, cchExt; - SplitPath(path, - wzDrive, _MAX_DRIVE, - wzDir, _MAX_DIR, - wzFname, _MAX_FNAME, - wzExt, _MAX_EXT); + SplitPathInterior(path, + &wzDrive, &cchDrive, + &wzDir, &cchDir, + &wzFname, &cchFname, + &wzExt, &cchExt); if (drive != NULL) - drive->CloseBuffer(static_cast<COUNT_T>(wcslen(wzDrive))); + drive->Set(wzDrive, (COUNT_T)cchDrive); if (dir != NULL) - dir->CloseBuffer(static_cast<COUNT_T>(wcslen(wzDir))); + dir->Set(wzDir, (COUNT_T)cchDir); if (fname != NULL) - fname->CloseBuffer(static_cast<COUNT_T>(wcslen(wzFname))); + fname->Set(wzFname, (COUNT_T)cchFname); if (ext != NULL) - ext->CloseBuffer(static_cast<COUNT_T>(wcslen(wzExt))); + ext->Set(wzExt, (COUNT_T)cchExt); } |