mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 458252: local file paths are wrong on windows mobile r=dougt sr=bsmedberg
This commit is contained in:
parent
1c7e7d7d96
commit
791430bafe
@ -58,8 +58,14 @@ net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result)
|
||||
path.ReplaceChar(PRUnichar(0x5Cu), PRUnichar(0x2Fu));
|
||||
|
||||
nsCAutoString escPath;
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "file:///");
|
||||
|
||||
// Windows Desktop paths beging with a drive letter, so need an 'extra'
|
||||
// slash at the begining
|
||||
#ifdef WINCE // /Windows => file:///Windows
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "file://");
|
||||
#else // C:\Windows => file:///C:/Windows
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "file:///");
|
||||
#endif
|
||||
// Escape the path with the directory mask
|
||||
NS_ConvertUTF16toUTF8 ePath(path);
|
||||
if (NS_EscapeURL(ePath.get(), -1, esc_Directory+esc_Forced, escPath))
|
||||
@ -133,9 +139,11 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
|
||||
if (path.Length() != strlen(path.get()))
|
||||
return NS_ERROR_FILE_INVALID_PATH;
|
||||
|
||||
#ifndef WINCE
|
||||
// remove leading '\'
|
||||
if (path.CharAt(0) == '\\')
|
||||
path.Cut(0, 1);
|
||||
#endif
|
||||
|
||||
if (IsUTF8(path))
|
||||
rv = localFile->InitWithPath(NS_ConvertUTF8toUTF16(path));
|
||||
|
@ -900,12 +900,16 @@ nsLocalFile::InitWithPath(const nsAString &filePath)
|
||||
PRUnichar *path = nsnull;
|
||||
PRInt32 pathLen = 0;
|
||||
|
||||
if ( ( (secondChar == L':') && !FindCharInReadable(L'/', begin, end) ) || // normal path
|
||||
#ifdef WINCE
|
||||
( (firstChar == L'\\') ) // wince absolute path or network path
|
||||
if ((
|
||||
!FindCharInReadable(L'/', begin, end) ) //normal path
|
||||
#ifndef WINCE
|
||||
&& (secondChar == L':') || // additional normal path condition
|
||||
(secondChar == L'\\') && // addtional network path condition
|
||||
#else
|
||||
( (firstChar == L'\\') && (secondChar == L'\\') ) // network path
|
||||
||
|
||||
#endif
|
||||
(firstChar == L'\\') // wince absolute path or network path
|
||||
|
||||
)
|
||||
{
|
||||
// This is a native path
|
||||
|
Loading…
Reference in New Issue
Block a user