Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / xpcom / io / nsAnonymousTemporaryFile.h
blob8e900dda4c11fdcad6e129f4a30ce294f6407c27
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #pragma once
9 #include "prio.h"
10 #include "nscore.h"
11 #include "nsIFile.h"
13 /**
14 * OpenAnonymousTemporaryFile
16 * Creates and opens a temporary file which has a random name. Callers have no
17 * control over the file name, and the file is opened in a temporary location
18 * which is appropriate for the platform.
20 * Upon success, aOutFileDesc contains an opened handle to the temporary file.
21 * The caller is responsible for closing the file when they're finished with it.
23 * The file will be deleted when the file handle is closed. On non-Windows
24 * platforms the file will be unlinked before this function returns. On Windows
25 * the OS supplied delete-on-close mechanism is unreliable if the application
26 * crashes or the computer power cycles unexpectedly, so unopened temporary
27 * files are purged at some time after application startup.
30 nsresult NS_OpenAnonymousTemporaryFile(PRFileDesc** aOutFileDesc);
32 /**
33 * OpenAnonymousTemporaryNsIFile
35 * Similar to the previous function, it returns a nsIFile. Note that the nsIFile
36 * will not be deleted automagically. The callee has to call aFile->Remove() in
37 * order to remove the temporary file.
39 nsresult NS_OpenAnonymousTemporaryNsIFile(nsIFile** aFile);