Results 1 to 2 of 2

Thread: File exists even if it should have deleted

  1. #1
    Join Date
    Sep 2010
    Location
    Denmark
    Posts
    28
    Thanks
    10
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default File exists even if it should have deleted

    Hi
    I'm working on a storyboard program, and something puzzles me.
    I'm saving the storyboard pads as PNG-files. If I want to erase a pad, I want to erase the file as well.
    Here is the code. ('ret' is the return value from a QMessageBox)
    Qt Code:
    1. qDebug() << projFilePath + sceneDir + "/" + padInfo[fileName];
    2. QFile fPad;
    3. fPad.setFileName(projFilePath + sceneDir + "/" + padInfo[fileName]);
    4. switch (ret) {
    5. case QMessageBox::Ok:
    6. qDebug() << "OK pressed";
    7. if (!fPad.remove())
    8. qDebug() << "delete file failure";
    To copy to clipboard, switch view to plain text mode 
    There are three qDebug-messages:
    The first writes the correct path. It is checked and doublechecked.
    The second is written and proves that I indeed pressed 'OK'.
    The third is not written, meaning that the file was removed.

    When I run the code in debug mode, the file 'fPad' goes from 'exists = true' to 'exists = false'.

    But - the file is not deleted... Please help with any suggestions to solve this.

  2. #2
    Join Date
    Sep 2010
    Location
    Denmark
    Posts
    28
    Thanks
    10
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: File exists even if it should have deleted

    Solved! - and I don't know how...

    Frustrations made me to put it aside for most of the day, and now it works.
    It is the code above that does the trick. Curious...

Similar Threads

  1. How to check the file to download from ftp site exists ?
    By nikhilqt in forum Qt Programming
    Replies: 29
    Last Post: 8th November 2014, 10:47
  2. Replies: 2
    Last Post: 20th September 2013, 23:47
  3. File exists on server
    By Chops211 in forum Qt Programming
    Replies: 5
    Last Post: 6th August 2011, 21:22
  4. Replies: 2
    Last Post: 21st February 2011, 15:52
  5. Can't create folder if file with same name exists
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2009, 17:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.