fixes bug 129279 "nsIFile unicode/utf8/ascii task"

r=dougt sr=alecf
This commit is contained in:
darin%netscape.com 2006-05-17 02:34:09 +00:00
Родитель 47382b40e8
Коммит 213e16303a
2 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -171,9 +171,9 @@ inFileSearch::GetStringResultAt(PRInt32 aIndex, nsAString& _retval)
}
if (file) {
nsXPIDLCString temp;
mLastResult->GetPath(getter_Copies(temp));
_retval = NS_ConvertASCIItoUCS2(temp);
nsCAutoString temp;
mLastResult->GetPath(temp);
_retval = NS_ConvertUTF8toUCS2(temp);
if (mReturnRelativePaths)
MakePathRelative(_retval);
} else {
@ -543,11 +543,10 @@ inFileSearch::GetNextDirectory(nsISimpleEnumerator* aEnum)
PRBool
inFileSearch::MatchFile(nsIFile* aFile)
{
char* fileName;
aFile->GetLeafName(&fileName);
nsCAutoString fileName;
aFile->GetLeafName(fileName);
nsAutoString temp;
temp.AssignWithConversion(fileName);
NS_ConvertUTF8toUCS2 temp(fileName);
PRUnichar* fileNameUnicode = ToNewUnicode(temp);
@ -558,6 +557,7 @@ inFileSearch::MatchFile(nsIFile* aFile)
if (match) return PR_TRUE;
}
// XXX are we leaking fileNameUnicode?
return PR_FALSE;
}
@ -610,10 +610,9 @@ inFileSearch::MakePathRelative(nsAString& aPath)
{
// get an nsAutoString version of the search path
char* temp;
mSearchPath->GetPath(&temp);
nsAutoString searchPath;
searchPath.AssignWithConversion(temp);
nsCAutoString temp;
mSearchPath->GetPath(temp);
NS_ConvertUTF8toUCS2 searchPath(temp);
nsAutoString result;
PRUint32 len = searchPath.Length();

Просмотреть файл

@ -46,7 +46,7 @@ function Startup()
// if both pref and dir svc fail leave this field blank else show path
if (path)
document.getElementById("browserCacheDiskCacheFolder").value =
path.unicodePath;
path.path;
}
@ -75,7 +75,7 @@ function prefCacheSelectFolder()
if (ret == nsIFilePicker.returnOK) {
var localFile = fp.file.QueryInterface(nsILocalFile);
var viewable = fp.file.unicodePath;
var viewable = fp.file.path;
var folderField = document.getElementById("browserCacheDiskCacheFolder");
folderField.value = viewable;
pref.setComplexValue(kCacheParentDirPref, nsILocalFile, localFile)