From 830c30522969f34044c7f1beac7300d736c6aeb2 Mon Sep 17 00:00:00 2001 From: "dougt%meer.net" Date: Fri, 11 Feb 2005 23:13:38 +0000 Subject: [PATCH] nsLocalFileWin::IsExecutable needs to trim trailing dots. After talking with dbaron, we agreeded that we shouldn't mutate the object. r=dbaron, a=dveditz git-svn-id: svn://10.0.0.236/trunk@169132 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileWin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/xpcom/io/nsLocalFileWin.cpp b/mozilla/xpcom/io/nsLocalFileWin.cpp index 6c23cc3e4e7..c44e92aa196 100644 --- a/mozilla/xpcom/io/nsLocalFileWin.cpp +++ b/mozilla/xpcom/io/nsLocalFileWin.cpp @@ -1870,8 +1870,6 @@ nsLocalFile::IsExecutable(PRBool *_retval) nsresult rv; - Normalize(); - // only files can be executables PRBool isFile; rv = IsFile(&isFile); @@ -1892,6 +1890,13 @@ nsLocalFile::IsExecutable(PRBool *_retval) else GetNativePath(path); + // kill trailing dots and spaces. + PRInt32 filePathLen = path.Length() - 1; + while(filePathLen > 0 && (path[filePathLen] == ' ' || path[filePathLen] == '.')) + { + path.Truncate(filePathLen--); + } + // Get extension. char * ext = (char *) _mbsrchr((unsigned char *)path.BeginWriting(), '.'); if ( ext ) {