Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator, Linux, goes wrong adding a filename with a space - bug?

Qt Creator, Linux, goes wrong adding a filename with a space - bug?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 558 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #1

    Ubuntu 19.04, Qt Creator 4.8.1, Qt 5.12.2 (last one should not be relevant).

    C++ project. Trying to add an "asset" file to the project, which is a .jpg with a space in it, in another directory. Creator successfully creates Other files node, with my directory under it, and a file in there which does not have a space:
    Screenshot from 2020-02-25 09-37-30.png

    But another file there I want to add has spaces, e.g. After the Holocaust.jpg. Upon trying to add this, Creator does its "hour-glass think" on the Project files, but never shows the file. Exiting and re-entering does not help. However, renaming it to not have any spaces does work.

    Looking into what it's doing in the .pro file, I see:

    DISTFILES += \
        docs/AftertheHolocaust.pdf \
        docs/After The Holocaust Map.jpg \
        ../docs/After The Holocaust Map.jpg \
        ../docs/After The Holocaust Map.jpg \
        ../docs/After The Holocaust Map.jpg \
        ../docs/After The.jpg \
        ../docs/After The.jpg
    

    So it's adding it multiple times (yes, I do do Remove... each time before trying to re-add, if that's supposed to remove it from the list that does not work either.). And for all files in that directory, if they contain a space it never shows up in Creator, but if I remove spaces it does.

    Note that I have only tried with this Other files. I have not tried e.g. with a source file (I don't intend by those to have spaces).

    To put those lines into the .pro, is Creator supposed to maybe quote/backslash each name which has a space, and because it's not doing so does not parse back correctly? Just a thought....

    For now I'll have to rename that asset if I want to include it, but that's not right....

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Just wrap it inside double quotes DISTFILES += "../docs/After The Holocaust Map.jpg"

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      JonBJ 1 Reply Last reply
      6
      • VRoninV VRonin

        Just wrap it inside double quotes DISTFILES += "../docs/After The Holocaust Map.jpg"

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @VRonin
        So every time I add a file with a space through picking it via the File Chooser in Qt Creator, I need to go off and edit the .pro file to correct it? This is a cross-platform asset, emanating from PC with spaces, I expect it to work. I'm not complaining about your workaround --- for which many thanks, I have checked that seems to work --- but is this not a bug in Creator (under Linux at least) then?

        1 Reply Last reply
        1
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          The management of spaces by qmake (and hence Qt Creator) has been a challenge for a while some people tried to fix it but it's one of the cases where the below rule is true.
          The system is transitioning to CMake anyway as primary project manager so I'm not expecting the issue to get solved

          99 Little Bugs

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          JonBJ 1 Reply Last reply
          3
          • VRoninV VRonin

            The management of spaces by qmake (and hence Qt Creator) has been a challenge for a while some people tried to fix it but it's one of the cases where the below rule is true.
            The system is transitioning to CMake anyway as primary project manager so I'm not expecting the issue to get solved

            99 Little Bugs

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @VRonin
            Thank you for replying. Yes, spaces are a mess even under Windoze, I know how that can be for Linux :)

            I will just mark your earlier answer as accepted then, thanks.

            P.S.
            Your pic is about what happens to me when my cat walks across the keyboard when I'm editing code... ;-)

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved