include/llfio/v2.0/file_handle.hpp
/*! Create a file handle creating the named file on some path which
  the OS declares to be suitable for temporary files. Most OSs are
  very lazy about flushing changes made to these temporary files.
  Note the default flags are to have the newly created file deleted
  on first handle close.
  Note also that an empty name is equivalent to calling
  `uniquely_named_file(path_discovery::storage_backed_temporary_files_directory())` and the creation
  parameter is ignored.

  \note If the temporary file you are creating is not going to have its
  path sent to another process for usage, this is the WRONG function
  to use. Use `temp_inode()` instead, it is far more secure.

  \errors Any of the values POSIX open() or CreateFile() can return.
  */
Create a file handle creating the named file on some path which
the OS declares to be suitable for temporary files. Most OSs are
very lazy about flushing changes made to these temporary files.
Note the default flags are to have the newly created file deleted
on first handle close.
Note also that an empty name is equivalent to calling
`uniquely_named_file(path_discovery::storage_backed_temporary_files_directory())` and the creation
parameter is ignored.

\note If the temporary file you are creating is not going to have its
path sent to another process for usage, this is the WRONG function
to use. Use `temp_inode()` instead, it is far more secure.

\errors Any of the values POSIX open() or CreateFile() can return.
Create a file handle creating the named file on some path which the OS declares to be suitable for temporary files . Most OSs are very lazy about flushing changes made to these temporary files . Note the default flags are to have the newly created file deleted on first handle close . Note also that an empty name is equivalent to calling ` uniquely_named_file ( path_discovery :: storage_backed_temporary_files_directory () ) ` and the creation parameter is ignored . \ note If the temporary file you are creating is not going to have its path sent to another process for usage this is the WRONG function to use . Use ` temp_inode () ` instead it is far more secure . \ errors Any of the values POSIX open () or CreateFile () can return .
LLFIO_MAKE_FREE_FUNCTION
  static inline result<file_handle> temp_file(path_view_type name = path_view_type(), mode _mode = mode::write, creation _creation = creation::if_needed,
                                              caching _caching = caching::temporary, flag flags = flag::unlink_on_first_close) noexcept
  {
    auto &tempdirh = path_discovery::storage_backed_temporary_files_directory();
    return name.empty() ? uniquely_named_file(tempdirh, _mode, _caching, flags) : file(tempdirh, name, _mode, _creation, _caching, flags);
  }
LLFIO_MAKE_FREE_FUNCTION static inline result < file_handle > temp_file ( path_view_type name = path_view_type ( ) , mode _mode = mode :: write , creation _creation = creation :: if_needed , caching _caching = caching :: temporary , flag flags = flag :: unlink_on_first_close ) noexcept { auto & tempdirh = path_discovery :: storage_backed_temporary_files_directory ( ) ; return name . empty ( ) ? uniquely_named_file ( tempdirh , _mode , _caching , flags ) : file ( tempdirh , name , _mode , _creation , _caching , flags ) ; }
Create a file handle creating the named file on some path which
the OS declares to be suitable for temporary files.
Create a file handle creating the named file on some path which the OS declares to be suitable for temporary files .