为什么QFileInfo :: isExecutable()为“.msi”返回false文件? [英] Why does QFileInfo::isExecutable() return false for ".msi" files?

查看:345
本文介绍了为什么QFileInfo :: isExecutable()为“.msi”返回false文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用C ++和Qt开发一个应用程序,我需要知道输入文件是否可执行。

I'm currently developing an application using C++ and Qt and I need to know if an input file is executable.

我使用 QFileInfo :: isExecutable()这对大多数文件都正确, .msi 扩展,它返回false。

I'm using QFileInfo::isExecutable() which behaves correctly for most files, except for those with the .msi extension, for which it returns false.

我如何确定文件是否可执行?

How can I figure out for sure if a file is executable or not? I need to do this in Qt for cross-compatibility reasons.

推荐答案

你应该知道如何 QFileInfo: :isExecutable()确定一个文件为可执行文件:

You should know how QFileInfo::isExecutable() determines a file as executable:


  • 的文件是 .exe .com .bat

在类Unix系统中,它会检查文件的属性,并对具有执行权限的文件返回true。

In Unix-like systems, it checks the file's attribute and returns true for files which have execution permission.

因此,一个 .msi 文件不是一个可执行文件Windows。

So a .msi file isn't a executable file in view of Qt under Windows.

这篇关于为什么QFileInfo :: isExecutable()为“.msi”返回false文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆