final fix for bug 100212 - removal final dependency on necko from xpcom by removing nsIFile.URL r=dougt, sr=darin Yay!
git-svn-id: svn://10.0.0.236/trunk@111722 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1477,81 +1477,6 @@ nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator **entries)
|
||||
(void **)entries);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURL);
|
||||
*aURL = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
char* ePath = nsnull;
|
||||
nsCAutoString escPath;
|
||||
|
||||
rv = GetPath(&ePath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
}
|
||||
|
||||
escPath.Insert("file://", 0);
|
||||
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
CRTFREEIF(ePath);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLocalFile::SetURL(const char * aURL)
|
||||
{
|
||||
NS_ENSURE_ARG(aURL);
|
||||
nsresult rv;
|
||||
|
||||
nsXPIDLCString host, directory, fileBaseName, fileExtension;
|
||||
|
||||
rv = ParseURL(aURL, getter_Copies(host),
|
||||
getter_Copies(directory),
|
||||
getter_Copies(fileBaseName),
|
||||
getter_Copies(fileExtension));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString path;
|
||||
nsCAutoString component;
|
||||
|
||||
if (directory) {
|
||||
nsStdEscape(directory, esc_Directory, component);
|
||||
path += component;
|
||||
}
|
||||
if (fileBaseName)
|
||||
{
|
||||
nsStdEscape(fileBaseName, esc_FileBaseName, component);
|
||||
path += component;
|
||||
}
|
||||
if (fileExtension)
|
||||
{
|
||||
nsStdEscape(fileExtension, esc_FileExtension, component);
|
||||
path += '.';
|
||||
path += component;
|
||||
}
|
||||
|
||||
nsUnescape((char*)path.get());
|
||||
|
||||
rv = InitWithPath(path.get());
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Load(PRLibrary **_retval)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user