1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/io/nsAnonymousTemporaryFile.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#pragma once 1.11 + 1.12 +#include "prio.h" 1.13 +#include "nscore.h" 1.14 + 1.15 +/** 1.16 + * OpenAnonymousTemporaryFile 1.17 + * 1.18 + * Creates and opens a temporary file which has a random name. Callers have no 1.19 + * control over the file name, and the file is opened in a temporary location 1.20 + * which is appropriate for the platform. 1.21 + * 1.22 + * Upon success, aOutFileDesc contains an opened handle to the temporary file. 1.23 + * The caller is responsible for closing the file when they're finished with it. 1.24 + * 1.25 + * The file will be deleted when the file handle is closed. On non-Windows 1.26 + * platforms the file will be unlinked before this function returns. On Windows 1.27 + * the OS supplied delete-on-close mechanism is unreliable if the application 1.28 + * crashes or the computer power cycles unexpectedly, so unopened temporary 1.29 + * files are purged at some time after application startup. 1.30 + * 1.31 + */ 1.32 +nsresult 1.33 +NS_OpenAnonymousTemporaryFile(PRFileDesc** aOutFileDesc); 1.34 +