mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154435 - [nsDumpUtil] Refine nsDumpUtils::OpenTempFile to make this function more flexible. r=dhylands
- Add one more mode in this function (CREATE/CREATE_UNIQUE) - export the header file for the usage of other components
This commit is contained in:
parent
93796994ce
commit
64f03fb24f
@ -53,6 +53,7 @@ EXPORTS += [
|
|||||||
'nscore.h',
|
'nscore.h',
|
||||||
'nsCycleCollector.h',
|
'nsCycleCollector.h',
|
||||||
'nsDebugImpl.h',
|
'nsDebugImpl.h',
|
||||||
|
'nsDumpUtils.h',
|
||||||
'nsError.h',
|
'nsError.h',
|
||||||
'nsGZFileWriter.h',
|
'nsGZFileWriter.h',
|
||||||
'nsIID.h',
|
'nsIID.h',
|
||||||
|
@ -435,7 +435,7 @@ FifoWatcher::OnFileCanReadWithoutBlocking(int aFd)
|
|||||||
// Otherwise, it will open a file named aFilename under "NS_OS_TEMP_DIR".
|
// Otherwise, it will open a file named aFilename under "NS_OS_TEMP_DIR".
|
||||||
/* static */ nsresult
|
/* static */ nsresult
|
||||||
nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
|
nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
|
||||||
const nsACString& aFoldername)
|
const nsACString& aFoldername, Mode aMode)
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
// For Android, first try the downloads directory which is world-readable
|
// For Android, first try the downloads directory which is world-readable
|
||||||
@ -488,9 +488,13 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0666);
|
if (aMode == CREATE_UNIQUE) {
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
rv = file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0666);
|
||||||
return rv;
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file->Create(nsIFile::NORMAL_FILE_TYPE, 0666);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
@ -180,10 +180,15 @@ private:
|
|||||||
|
|
||||||
#endif // XP_UNIX }
|
#endif // XP_UNIX }
|
||||||
|
|
||||||
|
|
||||||
class nsDumpUtils
|
class nsDumpUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
CREATE,
|
||||||
|
CREATE_UNIQUE
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a new unique file based on |aFilename| in a
|
* This function creates a new unique file based on |aFilename| in a
|
||||||
* world-readable temp directory. This is the system temp directory
|
* world-readable temp directory. This is the system temp directory
|
||||||
@ -193,7 +198,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static nsresult OpenTempFile(const nsACString& aFilename,
|
static nsresult OpenTempFile(const nsACString& aFilename,
|
||||||
nsIFile** aFile,
|
nsIFile** aFile,
|
||||||
const nsACString& aFoldername = EmptyCString());
|
const nsACString& aFoldername = EmptyCString(),
|
||||||
|
Mode aMode = CREATE_UNIQUE);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user