Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
// 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15)
int indexOfDot = ctype.indexOf('.');
if (indexOfDot != -1)
- localeMapper = checkForCodec( ctype.mid(indexOfDot + 1) );
+ localeMapper = checkForCodec(ctype.mid(indexOfDot + 1));
// 2. CODESET from lang if it contains a .CODESET part
if (!localeMapper) {
indexOfDot = lang.indexOf('.');
if (indexOfDot != -1)
- localeMapper = checkForCodec( lang.mid(indexOfDot + 1) );
+ localeMapper = checkForCodec(lang.mid(indexOfDot + 1));
}
// 3. ctype (maybe the locale is named "ISO-8859-1" or something)
name = QString::fromLocal8Bit(::getprogname());
}
#else
+#if defined(QT_HAVE_PROC_EXE)
+ if (name.isEmpty()) {
+ // Try looking for a /proc/<pid>/exe symlink first which points to
+ // the absolute path of the executable
+ QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(::getpid()));
+ if (pfi.exists() && pfi.isSymLink()) {
+ pfi.setFile(pfi.canonicalFilePath());
+ name = pfi.baseName();
+ }
+ }
+#endif
+
if (name.isEmpty() && self) {
char ** const argv = self->d_func()->argv;
if (argv[0]) {