mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1428543 - Add nsIFile::HumanReadablePath. r=froydnj
This method is used to replace some GetNativePath usage for logging. MozReview-Commit-ID: 9nWf2r4oviA --HG-- extra : rebase_source : b58e45ab38621179cd802979131fdddbfe65079e extra : intermediate-source : b4ded2247082f98fe18eb640c5fafeb9bc107ac0 extra : source : 21a82c1faeffc7c0d7b3a5ef0ae4c5243c81a586
This commit is contained in:
parent
51d70c873f
commit
410788f63d
@ -258,9 +258,13 @@ interface nsIFile : nsISupports
|
||||
readonly attribute AString target;
|
||||
[noscript] readonly attribute ACString nativeTarget;
|
||||
readonly attribute AString path;
|
||||
[notxpcom,nostdcall] PathString nativePath();
|
||||
[notxpcom,nostdcall,must_use] PathString nativePath();
|
||||
%{C++
|
||||
nsresult GetNativePath(nsACString& aPath);
|
||||
/*
|
||||
* Returns a human-readable path string.
|
||||
*/
|
||||
nsCString HumanReadablePath();
|
||||
%}
|
||||
|
||||
boolean exists();
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -604,6 +605,15 @@ nsIFile::GetNativePath(nsACString& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString
|
||||
nsIFile::HumanReadablePath()
|
||||
{
|
||||
nsCString path;
|
||||
DebugOnly<nsresult> rv = GetNativePath(path);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return path;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLocalFile::GetNativeTargetPathName(nsIFile* aNewParent,
|
||||
const nsACString& aNewName,
|
||||
|
@ -3565,6 +3565,15 @@ nsIFile::GetNativePath(nsACString& aResult)
|
||||
return NS_CopyUnicodeToNative(NativePath(), aResult);
|
||||
}
|
||||
|
||||
nsCString
|
||||
nsIFile::HumanReadablePath()
|
||||
{
|
||||
nsString path;
|
||||
DebugOnly<nsresult> rv = GetPath(path);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return NS_ConvertUTF16toUTF8(path);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetNativeCanonicalPath(nsACString& aResult)
|
||||
|
Loading…
Reference in New Issue
Block a user