2 * Copyright 2012 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef FOLLY_TESTUTIL_H_
18 #define FOLLY_TESTUTIL_H_
28 * By default, the file is created in a system-specific location (the value
29 * of the TMPDIR environment variable, or /tmp), but you can override that
30 * by making "prefix" be a path (containing a '/'; use a prefix starting with
31 * './' to create a file in the current directory).
33 * By default, the file is closed and deleted when the TemporaryFile object
34 * is destroyed, but both these behaviors can be overridden with arguments
44 explicit TemporaryFile(const char* prefix=nullptr,
45 Scope scope=Scope::UNLINK_ON_DESTRUCTION,
46 bool closeOnDestruction=true);
49 int fd() const { return fd_; }
50 const std::string& path() const;
54 bool closeOnDestruction_;
62 #endif /* FOLLY_TESTUTIL_H_ */