removal lame nsFileSpec operators, bug 100676 r=ccarlen sr=waterson

git-svn-id: svn://10.0.0.236/trunk@111730 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com 2002-01-09 21:31:19 +00:00
parent 2a9bbedb17
commit 26792f7cf9
5 changed files with 4 additions and 68 deletions

View File

@ -441,7 +441,7 @@ IsLoadableDTD(nsCOMPtr<nsIURI>* aDTD)
res = dtdURL->GetFileName(getter_Copies(fileName));
if (NS_SUCCEEDED(res) && fileName) {
nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
dtdPath += NS_ConvertASCIItoUCS2(nsDependentCString(kDTDDirectory) + fileName);
dtdPath += PromiseFlatCString(nsDependentCString(kDTDDirectory) + fileName).get();
if (dtdPath.Exists()) {
// The DTD was found in the local DTD directory.
// Set aDTD to a file: url pointing to the local DTD

View File

@ -1060,11 +1060,11 @@ nsresult nsAbMDBDirectory::GetAbDatabase()
if(NS_SUCCEEDED(rv))
abSession->GetUserProfileDirectory(&dbPath);
NS_ConvertUTF8toUCS2 file(&(mURI[strlen(kMDBDirectoryRoot)]));
nsCAutoString file(&(mURI[strlen(kMDBDirectoryRoot)]));
PRInt32 pos = file.Find("/");
if (pos != -1)
file.Truncate(pos);
(*dbPath) += file;
(*dbPath) += file.get();
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);

View File

@ -441,7 +441,7 @@ IsLoadableDTD(nsCOMPtr<nsIURI>* aDTD)
res = dtdURL->GetFileName(getter_Copies(fileName));
if (NS_SUCCEEDED(res) && fileName) {
nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
dtdPath += NS_ConvertASCIItoUCS2(nsDependentCString(kDTDDirectory) + fileName);
dtdPath += PromiseFlatCString(nsDependentCString(kDTDDirectory) + fileName).get();
if (dtdPath.Exists()) {
// The DTD was found in the local DTD directory.
// Set aDTD to a file: url pointing to the local DTD

View File

@ -336,7 +336,6 @@ class NS_COM nsFileSpec
// These two operands take *native* file paths.
void operator = (const char* inNativePath);
void operator = (const nsString& inNativePath);
void operator = (const nsFilePath& inPath);
void operator = (const nsFileURL& inURL);
@ -419,7 +418,6 @@ class NS_COM nsFileSpec
// inLeafName can be a relative path, so this allows
// one kind of concatenation of "paths".
void SetLeafName(const char* inLeafName);
void SetLeafName(const nsString& inLeafName);
// Return the filespec of the parent directory. Used
// in conjunction with GetLeafName(), this lets you
@ -455,7 +453,6 @@ class NS_COM nsFileSpec
PRInt64 GetDiskSpaceAvailable() const;
nsFileSpec operator + (const char* inRelativeUnixPath) const;
nsFileSpec operator + (const nsString& inRelativeUnixPath) const;
// Concatenate the relative path to this directory.
// Used for constructing the filespec of a descendant.
@ -467,11 +464,9 @@ class NS_COM nsFileSpec
// "below" this.
void operator += (const char* inRelativeUnixPath);
void operator += (const nsString& inRelativeUnixPath);
void MakeUnique();
void MakeUnique(const char* inSuggestedLeafName);
void MakeUnique(const nsString& inSuggestedLeafName);
PRBool IsDirectory() const; // More stringent than Exists()
@ -498,11 +493,9 @@ class NS_COM nsFileSpec
void RecursiveCopy(nsFileSpec newDir) const;
nsresult Rename(const char* inNewName); // not const: gets updated
nsresult Rename(const nsString& inNewName);
nsresult CopyToDir(const nsFileSpec& inNewParentDirectory) const;
nsresult MoveToDir(const nsFileSpec& inNewParentDirectory);
nsresult Execute(const char* args) const;
nsresult Execute(const nsString& args) const;
protected:

View File

@ -337,60 +337,3 @@ NS_NewUnicodeLocalFile(const PRUnichar* path, PRBool followLinks, nsILocalFile*
SET_UCS_2ARGS_1( NS_NewLocalFile, path, followLinks, result)
}
// ==================================================================
// nsFileSpec stuff - here until nsFileSpec gets obsoleted
// ==================================================================
void nsFileSpec::operator = (const nsString& inNativePath)
{
char* tmp;
nsresult res;
if(NS_SUCCEEDED(res = nsFSStringConversion::UCSToNewFS((inNativePath.get()), &tmp))) {
*this = tmp;
nsMemory::Free(tmp);
}
mError = res;
NS_ASSERTION(NS_SUCCEEDED(res), "nsFileSpec = filed");
}
nsFileSpec nsFileSpec::operator + (const nsString& inRelativeUnixPath) const
{
nsFileSpec resultSpec;
char* tmp;
nsresult res;
if(NS_SUCCEEDED(res = nsFSStringConversion::UCSToNewFS((inRelativeUnixPath.get()), &tmp))) {
resultSpec = *this;
resultSpec += tmp;
nsMemory::Free(tmp);
}
NS_ASSERTION(NS_SUCCEEDED(res), "nsFileSpec + filed");
return resultSpec;
}
void nsFileSpec::operator += (const nsString& inRelativeUnixPath)
{
char* tmp;
nsresult res;
if(NS_SUCCEEDED(res = nsFSStringConversion::UCSToNewFS((inRelativeUnixPath.get()), &tmp))) {
*this += tmp;
nsMemory::Free(tmp);
}
mError = res;
NS_ASSERTION(NS_SUCCEEDED(res), "nsFileSpec + filed");
}
void nsFileSpec::SetLeafName (const nsString& inLeafName)
{
VOID_SET_UCS( SetLeafName , inLeafName.get(),"nsFileSpec::SetLeafName failed");
}
void nsFileSpec::MakeUnique(const nsString& inSuggestedLeafName)
{
VOID_SET_UCS( MakeUnique,inSuggestedLeafName.get(),"nsFileSpec::MakeUnique failed");
}
nsresult nsFileSpec::Rename(const nsString& inNewName)
{
SET_UCS( Rename , inNewName.get());
}
nsresult nsFileSpec::Execute(const nsString& args) const
{
SET_UCS( Execute , args.get());
}