Linux嵌入式配置/etc/profile文件

Linux嵌入式配置/etc/profile文件

void mountMouse()
{
    QFile profile("/etc/profile");
    if (profile.exists()) {
        if (profile.open(QIODevice::ReadWrite)) {
            QByteArray fileData(profile.readAll());
            if (!fileData.contains("tslib:/dev/input/event0 intellimouse:/dev/input/event1")) {
                if (fileData.contains("tslib:/dev/input/event0")) {
                    fileData.replace("tslib:/dev/input/event0", "\"tslib:/dev/input/event0 intellimouse:/dev/input/mouse1\"");
                    profile.write(fileData);
                    QLOG_DEBUG() << "MountMouse Is Success";
                } else {
                    QLOG_DEBUG() << "tslib:/dev/input/event0 Is Nothingness";
                }
            } else {
                QLOG_DEBUG() << "MountMouse Is Exists";
            }
            profile.close();
        }
    }
}

你可能感兴趣的:(linux,QT,嵌入式)