I tried the following short example to find out about a bug in a larger program I'm working on. It seems that QFile does not support nonix (or shell) for the home directory:
#include <QFile>
#include <QDebug>
int main()
{
QFile f("~/.vimrc");
if (f.open(QIODevice::ReadOnly))
{
qDebug() << f.readAll();
f.close();
}
else
{
qDebug() << f.error();
}
}
As soon as I replace "~" with my real path to the home directory, it works. Is there an easy workaround - some settings allow? Or do I need to go the "ugly" way and ask QDir for the current user's home directory and add it manually to each path?
Feature: . It is clear that usually the shell performs tilde expansion, so programs have never seen this. However, it is so convenient in unix shells that I was hoping that the Qt implementation for file access would include this extension.