Repository: microsoft/terminal
File: src/cascadia/TerminalControl/TermControl.cpp (C++)

Code before:
                        const uint32_t streamSize = gsl::narrow_cast<uint32_t>stream.Size();
                        const Buffer buf(streamSize);
                        const auto buffer = co_await stream.ReadAsync(buf, streamSize, InputStreamOptions::None);

                        const HGLOBAL hGlobal = buffer.data();
                        const auto count = DragQueryFile((HDROP)hGlobal, 0xFFFFFFFF, nullptr, 0);
                        fullPaths.reserve(count);

                        for (unsigned int i = 0; i < count; i++)
                        {
                            WCHAR szPath[MAX_PATH];
                            const auto charsCopied = DragQueryFile((HDROP)hGlobal, i, szPath, MAX_PATH);

                            if (charsCopied > 0)
                            {
                                fullPaths.push_back(std::wstring{ szPath });
                            }
                        }
                    }
                }
                else
                {
                    fullPaths.reserve(items.Size());
                    for (auto item : items)
                    {
                        fullPaths.push_back(std::wstring{ item.Path() });
                    }
                }

                std::wstring allPathsString;
                for (auto fullPath : fullPaths)
                {
                    // Join the paths with spaces
                    if (!allPathsString.empty())
                    {
                        allPathsString += L" ";
                    }

                    // Fix path for WSL
                    // In the fullness of time, we should likely plumb this up
                    // to the TerminalApp layer, and have it make the decision
                    // if this control should have it's path mangled (and do the
                    // mangling), rather than exposing the source concept to the
                    // Control layer.
                    //
                    // However, it's likely that the control layer may need to
                    // know about the source anyways in the future, to support
                    // GH#3158
                    if (_interactivity.ManglePathsForWsl())
                    {
                        std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/');

Review comment (suggestion):
```suggestion
                        fullPaths.emplace_back(item.Path());

```

Code after:
                        const uint32_t streamSize = gsl::narrow_cast<uint32_t>(stream.Size());
                        const Buffer buf(streamSize);
                        const auto buffer = co_await stream.ReadAsync(buf, streamSize, InputStreamOptions::None);

                        const HGLOBAL hGlobal = buffer.data();
                        const auto count = DragQueryFileW(static_cast<HDROP>(hGlobal), 0xFFFFFFFF, nullptr, 0);
                        fullPaths.reserve(count);

                        for (unsigned int i = 0; i < count; i++)
                        {
                            std::wstring path;
                            path.resize(wil::max_path_length);
                            const auto charsCopied = DragQueryFileW(static_cast<HDROP>(hGlobal), i, path.data(), wil::max_path_length);

                            if (charsCopied > 0)
                            {
                                path.resize(charsCopied);
                                fullPaths.emplace_back(std::move(path));
                            }
                        }
                    }
                }
                else
                {
                    fullPaths.reserve(items.Size());
                    for (const auto& item : items)
                    {
                        fullPaths.emplace_back(item.Path());
                    }
                }

                std::wstring allPathsString;
                for (auto& fullPath : fullPaths)
                {
                    // Join the paths with spaces
                    if (!allPathsString.empty())
                    {
                        allPathsString += L" ";
                    }

                    // Fix path for WSL
                    // In the fullness of time, we should likely plumb this up
                    // to the TerminalApp layer, and have it make the decision
                    // if this control should have it's path mangled (and do the
                    // mangling), rather than exposing the source concept to the
                    // Control layer.
                    //
                    // However, it's likely that the control layer may need to
                    // know about the source anyways in the future, to support
                    // GH#3158
                    if (_interactivity.ManglePathsForWsl())