From 18a39070301883bc4531670bb2941c3b1d6ee54e Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Tue, 9 May 2000 23:53:03 +0000 Subject: [PATCH] InitWithPath should not store trailing seperatores in paths. It really is an error to pass a trailing seperator, but we are just being kind. git-svn-id: svn://10.0.0.236/trunk@68932 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileUnix.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mozilla/xpcom/io/nsLocalFileUnix.cpp b/mozilla/xpcom/io/nsLocalFileUnix.cpp index 27a7c6dd36f..8ae810cd8b5 100644 --- a/mozilla/xpcom/io/nsLocalFileUnix.cpp +++ b/mozilla/xpcom/io/nsLocalFileUnix.cpp @@ -268,7 +268,16 @@ NS_IMETHODIMP nsLocalFile::InitWithPath(const char *filePath) { NS_ENSURE_ARG(filePath); - mPath = filePath; + + int len = strlen(filePath); + char* name = (char*) nsAllocator::Clone( filePath, len+1 ); + if(name[len-1] == '/') + name[len-1] = '\0'; + + mPath = name; + + nsAllocator::Free(name); + InvalidateCache(); return NS_OK; }