Handle long file paths during CIM creation (#463)

This commit is contained in:
stephenk-msft 2021-06-30 09:27:05 -07:00 коммит произвёл GitHub
Родитель 24d4ab1c04
Коммит 8d6b8fba9e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -334,10 +334,11 @@ int main(int argc, char * argv[])
} }
// Create a temporary directory to unpack package(s) since we cannot unpack to the CIM directly. // Create a temporary directory to unpack package(s) since we cannot unpack to the CIM directly.
// Append long path prefix to temporary directory path to handle paths that exceed the maximum path length limit
std::wstring currentDirectory = std::filesystem::current_path(); std::wstring currentDirectory = std::filesystem::current_path();
std::wstring uniqueIdString; std::wstring uniqueIdString;
RETURN_IF_FAILED(CreateGUIDString(&uniqueIdString)); RETURN_IF_FAILED(CreateGUIDString(&uniqueIdString));
std::wstring tempDirPathString = currentDirectory + L"\\" + uniqueIdString; std::wstring tempDirPathString = L"\\\\?\\" + currentDirectory + L"\\" + uniqueIdString;
std::filesystem::path tempDirPath(tempDirPathString); std::filesystem::path tempDirPath(tempDirPathString);
std::error_code createDirectoryErrorCode; std::error_code createDirectoryErrorCode;