Bug 462034. Should consider .desktop files executable. r=bsmedberg
git-svn-id: svn://10.0.0.236/trunk@254789 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1306,6 +1306,11 @@ nsLocalFile::IsExecutable(PRBool *_retval)
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
struct stat buf;
|
||||
|
||||
if (IsDesktopFile()) {
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = (stat(mPath.get(), &buf) == 0);
|
||||
if (*_retval || errno == EACCES) {
|
||||
*_retval = *_retval && (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH ));
|
||||
@@ -1356,6 +1361,11 @@ nsLocalFile::IsExecutable(PRBool *_retval)
|
||||
CHECK_mPath();
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
if (IsDesktopFile()) {
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = (access(mPath.get(), X_OK) == 0);
|
||||
if (*_retval || errno == EACCES)
|
||||
return NS_OK;
|
||||
@@ -1842,3 +1852,13 @@ void
|
||||
nsLocalFile::GlobalShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLocalFile::IsDesktopFile()
|
||||
{
|
||||
// Just needs to be good enough to match nsFileProtocolHandler::ReadURLFile
|
||||
nsCAutoString leafName;
|
||||
nsresult rv = GetNativeLeafName(leafName);
|
||||
return NS_FAILED(rv) ||
|
||||
StringEndsWith(leafName, NS_LITERAL_CSTRING(".desktop"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user