mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
LibFileSystem: Move TempFile
from LibCore
to LibFileSystem
As suggested in commit de18485
This commit is contained in:
parent
492e5c3c14
commit
752f06f228
Notes:
sideshowbarker
2024-07-17 03:35:24 +09:00
Author: https://github.com/cammo1123
Commit: 752f06f228
Pull-request: https://github.com/SerenityOS/serenity/pull/17789
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/caoimhebyrne
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/linusg
Reviewed-by: https://github.com/pascalpuffke
Reviewed-by: https://github.com/timschumi ✅
6 changed files with 22 additions and 23 deletions
41
Userland/Libraries/LibFileSystem/TempFile.h
Normal file
41
Userland/Libraries/LibFileSystem/TempFile.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2023, the SerenityOS developers.
|
||||
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace FileSystem {
|
||||
|
||||
class TempFile {
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_directory();
|
||||
static ErrorOr<NonnullOwnPtr<TempFile>> create_temp_file();
|
||||
|
||||
~TempFile();
|
||||
|
||||
String const& path() const { return m_path; }
|
||||
|
||||
private:
|
||||
enum class Type {
|
||||
Directory,
|
||||
File
|
||||
};
|
||||
|
||||
TempFile(Type type, String path)
|
||||
: m_type(type)
|
||||
, m_path(move(path))
|
||||
{
|
||||
}
|
||||
|
||||
Type m_type;
|
||||
String m_path;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue