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. Unable to check file existence if special character exist in path(foloded)

Unable to check file existence if special character exist in path(foloded)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.0k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    vivekmalik2466
    wrote on last edited by
    #1

    unable to check file existence if special character exist in path(foloded)

    " C:\Users\JAVA\Music\Mikaq#$% "

    if i check existence of file at this path i am unable to check it.

    @
    QString coverPath= (QString::fromStdString(album_name.toCString())+".png");
    coverPath=coverPath.remove(QRegExp("\s+$"));
    TagBuilder.storeCoverArt((iterator.fileInfo().absolutePath()+"/"+ coverPath),iterator.fileInfo().absoluteFilePath());
    obj_track.cover_path = iterator.fileInfo().absolutePath()+"/"+coverPath;
    if(!QFile::exists(obj_track.cover_path))
    {
    obj_track.cover_path=QString::fromStdString((iterator.fileInfo().absolutePath()+"/folder.jpg").toStdString());
    if(!QFile::exists(obj_track.cover_path))
    {
    obj_track.cover_path=QString::fromStdString((iterator.fileInfo().absolutePath()+"/folder.png").toStdString());
    if(!QFile::exists(obj_track.cover_path))
    {
    obj_track.cover_path = "qrc:///resources/images/no-artwork.png" ;
    }
    }
    }@

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Please explain how you are "unable to check" it. What error do you get?

      Also, please provide a simpler version of your code, to make it easier to see the error. The code you posted has too many conversions, that are not related to the error.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • A Offline
        A Offline
        absfrm
        wrote on last edited by
        #3

        check this:
        use "double back slash : \" and test it (if not windows , test double slash ://)

        If You Want You Can!

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vivekmalik2466
          wrote on last edited by
          #4

          hello i under stand the problem but dont have result .
          problem is at qml sile image source is not taking special character.
          can you help .

          problem code:

          @ Image {
          id: artwork
          height: 100
          width: 100
          source: coverart //here is the path with special character like(C:/Users/Administrator.VIVEK-PC/Music/Vicky Donor~!@#$%^&()/Vicky Donor.png)
          smooth: true
          z: 9
          anchors.horizontalCenter: parent.horizontalCenter
          anchors.top: parent.top
          anchors.topMargin: 8
          } @

          1 Reply Last reply
          0

          • Login

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