Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97759

QProcess::startDetached added quotes that cause errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 5.15.2
    • Core: I/O
    • None
    • Windows

    Description

      When I use QProcess::startDetached to open the file explorer and select the file, I don't have any problem if I use the following.

      Func A:
      QProcess::startDetached("explorer /select," + file_path);
      

      But when I switch to using the

      Func B:
      QProcess::startDetached("explorer", QStringList() << "/select," + file_path);

      if there are spaces in the middle of the file name, the func B will automatically generate a command with quotation marks like explorer “/select,D:\view vast.jpg” but func A is explorer /select,D:\view vast.jpg without quotes. Func B incorrectly adds unnecessary quotes causing this command to not work properly, whereas unnecessary quotes are only added if there are spaces in file_path. But Func A is QT_DEPRECATED.
      use setNativeArguments() and the non-static startDetached() variant didn't work either

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            0ices zero ices
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes