Create a QStringList from the array of C-style strings. */
| 35 | |
| 36 | /** Create a QStringList from the array of C-style strings. */ |
| 37 | QStringList |
| 38 | char_array_to_stringlist(char **arr, int len) |
| 39 | { |
| 40 | QStringList list; |
| 41 | for (int i = 0; i < len; i++) { |
| 42 | #ifdef WINDOWS_SYS |
| 43 | list << QString::fromLatin1(arr[i]); |
| 44 | #else |
| 45 | list << QString::fromUtf8(arr[i]); |
| 46 | #endif |
| 47 | |
| 48 | #ifdef CHAR_ARRAY_TO_STRINGLIST_DEBUG |
| 49 | std::cerr << "arr[" << i << "]==" << arr[i] << std::endl; |
| 50 | if (QFile(arr[i]).exists()) std::cerr << "arr[i] File exists" << std::endl; |
| 51 | std::cerr << "QString UTF8==" << QString::fromUtf8(arr[i]).toStdString() << std::endl; |
| 52 | if (QFile(QString::fromUtf8(arr[i])).exists()) std::cerr << "QString UTF8 File exists" << std::endl; |
| 53 | std::cerr << "QString Latin1==" << QString::fromLatin1(arr[i]).toStdString() << std::endl; |
| 54 | if (QFile(QString::fromLatin1(arr[i])).exists()) std::cerr << "QString Latin1 File exists" << std::endl; |
| 55 | #endif |
| 56 | } |
| 57 | return list; |
| 58 | } |
| 59 | |
| 60 | /** Conditionally assigns errmsg to str if str is not null and returns false. |
| 61 | * This is a seemingly pointless function, but it saves some messiness in |