Ignore:
Timestamp:
Dec 14, 2009, 8:14:19 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib/io: QFSFileEngine: Added workaround: On OS/2, trailing spaces in file names are ignored ("readme " = "readme") but kLIBC doesn't handle this well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qfsfileengine_os2.cpp

    r378 r422  
    179179void QFSFileEnginePrivate::nativeInitFileName()
    180180{
    181     nativeFilePath = QFile::encodeName(filePath);
     181    // On OS/2, trailing spaces in file names are ignored so that "readme " and
     182    // "readme" refers to the same file. However, kLIBC seems to not handle this
     183    // case well and returns ENOENT at least when attempting to access a file
     184    // named "somedir /file" (provided that "somedir" exists of course. To try
     185    // to seamlessly solve this issue, we remove such trailing spaces from path
     186    // components here.
     187    QString fp = filePath.replace(QRegExp("(?: *)([\\\\/$]|$)"), QLatin1String("\\1"));
     188    nativeFilePath = QFile::encodeName(fp);
    182189}
    183190
Note: See TracChangeset for help on using the changeset viewer.