From 7430419967d763aaec7c25a5fc2bb643ada6b0e4 Mon Sep 17 00:00:00 2001 From: "dougt%meer.net" Date: Fri, 11 Feb 2005 22:11:45 +0000 Subject: [PATCH] nsLocalFileWin::IsExecutable needs to trim trailing dots. Fixes bug 267828. r=dbaron, a=dveditz git-svn-id: svn://10.0.0.236/trunk@169126 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileWin.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mozilla/xpcom/io/nsLocalFileWin.cpp b/mozilla/xpcom/io/nsLocalFileWin.cpp index ebe9cd273f6..6c23cc3e4e7 100644 --- a/mozilla/xpcom/io/nsLocalFileWin.cpp +++ b/mozilla/xpcom/io/nsLocalFileWin.cpp @@ -930,7 +930,14 @@ nsLocalFile::Normalize() // add the current component to the path, including the preceding backslash normal.Append(pathBuffer + begin - 1, len + 1); } - + + // kill trailing dots and spaces. + PRInt32 filePathLen = normal.Length() - 1; + while(filePathLen > 0 && (normal[filePathLen] == ' ' || normal[filePathLen] == '.')) + { + normal.Truncate(filePathLen--); + } + NS_CopyUnicodeToNative(normal, mWorkingPath); MakeDirty(); #else // WINCE @@ -1863,6 +1870,8 @@ nsLocalFile::IsExecutable(PRBool *_retval) nsresult rv; + Normalize(); + // only files can be executables PRBool isFile; rv = IsFile(&isFile);