зеркало из https://github.com/mozilla/gecko-dev.git
bug 548426 - xpcom/tests/TestFile.exe fails for windows mobile r=bsmedberg
This commit is contained in:
Родитель
c3cac2c620
Коммит
61564a8d73
|
@ -415,7 +415,12 @@ OpenFile(const nsAFlatString &name, PRIntn osflags, PRIntn mode,
|
|||
}
|
||||
|
||||
if (osflags & nsILocalFile::DELETE_ON_CLOSE) {
|
||||
#ifdef WINCE
|
||||
NS_ASSERTION(!(osflags & nsILocalFile::DELETE_ON_CLOSE), "DELETE_ON_CLOSE is not supported on wince");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
#else
|
||||
flag6 |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
HANDLE file = ::CreateFileW(name.get(), access,
|
||||
|
@ -1097,7 +1102,6 @@ nsLocalFile::AppendInternal(const nsAFlatString &node, PRBool multipleComponents
|
|||
|| node.EqualsASCII("..")) // can't be ..
|
||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||
|
||||
#ifndef WINCE // who cares?
|
||||
if (multipleComponents)
|
||||
{
|
||||
// can't contain .. as a path component. Ensure that the valid components
|
||||
|
@ -1124,7 +1128,6 @@ nsLocalFile::AppendInternal(const nsAFlatString &node, PRBool multipleComponents
|
|||
// single components can't contain '\'
|
||||
else if (node.FindChar(L'\\') != kNotFound)
|
||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||
#endif
|
||||
|
||||
MakeDirty();
|
||||
|
||||
|
@ -1139,7 +1142,6 @@ nsLocalFile::AppendInternal(const nsAFlatString &node, PRBool multipleComponents
|
|||
NS_IMETHODIMP
|
||||
nsLocalFile::Normalize()
|
||||
{
|
||||
#ifndef WINCE
|
||||
// XXX See bug 187957 comment 18 for possible problems with this implementation.
|
||||
|
||||
if (mWorkingPath.IsEmpty())
|
||||
|
@ -1187,13 +1189,17 @@ nsLocalFile::Normalize()
|
|||
* manages to eject the drive between our call to _getdrives() and
|
||||
* our *calls* to _wgetdcwd.
|
||||
*/
|
||||
#ifdef WINCE
|
||||
// no concept of a cwd on wince, let alone a cwd per drive
|
||||
pcwd = L"\\";
|
||||
#else
|
||||
if (!((1 << (drive - 1)) & _getdrives()))
|
||||
return NS_ERROR_FILE_INVALID_PATH;
|
||||
if (!_wgetdcwd(drive, pcwd, MAX_PATH))
|
||||
pcwd = _wgetdcwd(drive, 0, 0);
|
||||
if (!pcwd)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
#endif
|
||||
nsAutoString currentDir(pcwd);
|
||||
if (pcwd != cwd)
|
||||
free(pcwd);
|
||||
|
@ -1291,9 +1297,6 @@ nsLocalFile::Normalize()
|
|||
}
|
||||
|
||||
MakeDirty();
|
||||
#else // WINCE
|
||||
// WINCE FIX
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2193,7 +2196,6 @@ nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
|
|||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
||||
#ifndef WINCE
|
||||
NS_ENSURE_ARG(aDiskSpaceAvailable);
|
||||
|
||||
ResolveAndStat();
|
||||
|
@ -2205,8 +2207,6 @@ nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
|
|||
*aDiskSpaceAvailable = liFreeBytesAvailableToCaller.QuadPart;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
// WINCE FIX
|
||||
*aDiskSpaceAvailable = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2741,7 +2741,6 @@ nsLocalFile::SetFileAttributesWin(PRUint32 aAttribs)
|
|||
NS_IMETHODIMP
|
||||
nsLocalFile::Reveal()
|
||||
{
|
||||
#ifndef WINCE
|
||||
// make sure mResolvedPath is set
|
||||
nsresult rv = ResolveAndStat();
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)
|
||||
|
@ -2754,8 +2753,11 @@ nsLocalFile::Reveal()
|
|||
nsAutoString explorerPath;
|
||||
rv = winDir->GetPath(explorerPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#ifdef WINCE
|
||||
explorerPath.Append(L"\\explorer.exe");
|
||||
|
||||
#else
|
||||
explorerPath.Append(L"\\fexplorer.exe");
|
||||
#endif
|
||||
// Always open a new window for files because Win2K doesn't appear to select
|
||||
// the file if a window showing that folder was already open. If the resolved
|
||||
// path is a directory then instead of opening the parent and selecting it,
|
||||
|
@ -2766,15 +2768,25 @@ nsLocalFile::Reveal()
|
|||
explorerParams.Append(L'\"');
|
||||
explorerParams.Append(mResolvedPath);
|
||||
explorerParams.Append(L'\"');
|
||||
|
||||
#ifdef WINCE
|
||||
SHELLEXECUTEINFO seinfo;
|
||||
memset(&seinfo, 0, sizeof(seinfo));
|
||||
seinfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
seinfo.fMask = NULL;
|
||||
seinfo.hwnd = NULL;
|
||||
seinfo.lpVerb = L"open";
|
||||
seinfo.lpFile = explorerPath.get();
|
||||
seinfo.lpParameters = explorerParams.get();
|
||||
seinfo.lpDirectory = NULL;
|
||||
seinfo.nShow = SW_SHOWNORMAL;
|
||||
if (!ShellExecuteEx(&seinfo))
|
||||
return NS_ERROR_FAILURE;
|
||||
#else
|
||||
if (::ShellExecuteW(NULL, L"open", explorerPath.get(), explorerParams.get(),
|
||||
NULL, SW_SHOWNORMAL) <= (HINSTANCE) 32)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
#endif
|
||||
}
|
||||
#ifdef WINCE
|
||||
#ifndef UNICODE
|
||||
|
|
|
@ -194,6 +194,7 @@ static PRBool TestCreateUnique(nsIFile* aBase, const char* aName, PRInt32 aType,
|
|||
static PRBool TestDeleteOnClose(nsIFile* aBase, const char* aName, PRInt32 aFlags, PRInt32 aPerm)
|
||||
{
|
||||
gFunction = "TestDeleteOnClose";
|
||||
#ifndef WINCE // Windows CE doesn't have the concept of delete on close, punt
|
||||
nsCOMPtr<nsILocalFile> file = NewFile(aBase);
|
||||
if (!file)
|
||||
return PR_FALSE;
|
||||
|
@ -229,7 +230,7 @@ static PRBool TestDeleteOnClose(nsIFile* aBase, const char* aName, PRInt32 aFlag
|
|||
fail("%s File %s was not removed on close!", gFunction, name.get());
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче