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

r=dougt sr=alecf


git-svn-id: svn://10.0.0.236/trunk@120092 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com
2002-04-27 05:33:09 +00:00
parent fadd9c12b4
commit 824def02af
210 changed files with 3081 additions and 2903 deletions

View File

@@ -304,13 +304,12 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsILocalFile> currentFile = do_CreateInstance("@mozilla.org/file/local;1");
if (currentFile && !defaultName.IsEmpty()) {
result = currentFile->InitWithUnicodePath(defaultName.get());
result = currentFile->InitWithPath(NS_ConvertUCS2toUTF8(defaultName));
if (NS_SUCCEEDED(result)) {
PRUnichar *leafName = nsnull;
currentFile->GetUnicodeLeafName(&leafName);
if (leafName) {
filePicker->SetDefaultString(leafName);
nsMemory::Free(leafName);
nsCAutoString leafName;
currentFile->GetLeafName(leafName);
if (!leafName.IsEmpty()) {
filePicker->SetDefaultString(NS_ConvertUTF8toUCS2(leafName).get());
}
// set directory
@@ -336,12 +335,11 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsILocalFile> localFile;
result = filePicker->GetFile(getter_AddRefs(localFile));
if (localFile) {
PRUnichar *nativePath = nsnull;
result = localFile->GetUnicodePath(&nativePath);
if (nativePath) {
nsAutoString pathName(nativePath);
nsCAutoString unicodePath;
result = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
NS_ConvertUTF8toUCS2 pathName(unicodePath);
mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, pathName);
nsMemory::Free(nativePath);
return NS_OK;
}
}