Results 1 to 6 of 6

Thread: Windows filesystem sync issues?

  1. #1
    Join Date
    Nov 2014
    Posts
    20
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Windows filesystem sync issues?

    I've run into interesting problems using Exiftool 10.10+, Qt 5.5.1 and Windows 10.

    I'm creating temporary file with QTemporaryFile, write there some data, save it, wait untill it's flushed using `FlushFileBuffers()` and afterwards pass this file as arguments file for `exiftool`. Data which I'm writing there is UTF-8 encoded paths to images:

    Qt Code:
    1. if (argumentsFile.open()) {
    2. QStringList exiftoolArguments = createArgumentsList();
    3. foreach (const QString &line, exiftoolArguments) {
    4. argumentsFile.write(line.toUtf8());
    5. argumentsFile.write("\r\n");
    6. }
    7. }
    8.  
    9. argumentsFile.flush()
    10.  
    11. // fsync stuff here...
    12.  
    13. argumentsFile.close()
    14. // starting exiftool with -@ argumentsFile.fileName() parameter here
    15. // also with -charset filename=UTF8
    To copy to clipboard, switch view to plain text mode 

    So the problem is the following: when filenames does not contain Unicode symbols, Exiftool reads images, imports Exif metadata and everything is fine.

    But when filenames contain Unicode symbols, sometimes Exiftool does not catch up them, unless I will insert `QThread::sleep(msec)` call which will make current thread to switch context and possible give ability to sync buffers for other threads (writing to harddrive).

    Exiftool run from cmd line with same file always reads metadata, unless started with QProcess with the way explained before. What can be the issue?
    Last edited by ribtoks; 16th March 2016 at 16:50.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Windows filesystem sync issues?

    Maybe you need to let the Qt event loop run between closing the file and starting the Exiftool process. Add a call to QCoreApplication::processEvents() and see if that helps.

  3. #3
    Join Date
    Nov 2014
    Posts
    20
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Windows filesystem sync issues?

    Thanks. Already tried it without much success

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Windows filesystem sync issues?

    Can you show how you use QProcess?

    Does the QTemporaryFile live through the life time of the QProcess?

    Cheers,
    _

  5. #5
    Join Date
    Nov 2014
    Posts
    20
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: Windows filesystem sync issues?

    Yes, it does. For sure.
    https://github.com/Ribtoks/xpiks/blo...orker.cpp#L145

    Qt Code:
    1. QString exiftoolPath = m_SettingsModel->getExifToolPath();
    2. QStringList arguments;
    3. arguments << "-charset" << "FileName=UTF8";
    4. arguments << "-@" << argumentsFile.fileName();
    5.  
    6. LOG_DEBUG << "Starting exiftool process:" << exiftoolPath;
    7. m_ExiftoolProcess->start(exiftoolPath, arguments);
    8.  
    9. success = m_ExiftoolProcess->waitForFinished();
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Windows filesystem sync issues?

    Try storing the filename before calling close().

    I vaguely remember the filename becoming empty when close is being called on a temporary file.
    But that was some time ago, could have been a bug or sometihg an older Qt version did.

    Cheers,
    _

Similar Threads

  1. QtCreator 3.5.1 on Windows 10 - hang issues
    By jojolepirate in forum Qt Tools
    Replies: 0
    Last Post: 5th November 2015, 23:55
  2. QWTPolar & Windows issues
    By aetoni in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2012, 01:30
  3. Build issues on Windows 7 with VS 2008
    By drewpt in forum Installation and Deployment
    Replies: 1
    Last Post: 15th July 2011, 19:35
  4. linux to windows porting issues
    By qtprogrammer12345 in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 07:45
  5. gtk not working in qt filesystem
    By apulu in forum Newbie
    Replies: 11
    Last Post: 18th April 2008, 11:22

Tags for this Thread

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.