AK: Remove unused TemporaryFile class.

This commit is contained in:
Andreas Kling 2019-04-03 13:20:08 +02:00
parent ce5d21ea19
commit ab6bd3872b
Notes: sideshowbarker 2024-07-19 14:50:29 +09:00
2 changed files with 0 additions and 59 deletions

View file

@ -1,33 +0,0 @@
#include "TemporaryFile.h"
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
namespace AK {
TemporaryFile::TemporaryFile()
{
char nameBuffer[] = "/tmp/AKTemporaryFile.XXXXXX";
int fd = mkstemp(nameBuffer);
if (fd != -1) {
m_stream = fdopen(fd, "w+");
m_file_name = nameBuffer;
}
}
TemporaryFile::~TemporaryFile()
{
if (is_valid()) {
unlink(m_file_name.characters());
fclose(m_stream);
}
}
void TemporaryFile::sync()
{
if (m_stream)
fflush(m_stream);
}
}

View file

@ -1,26 +0,0 @@
#pragma once
#include "AKString.h"
#include <stdio.h>
namespace AK {
class TemporaryFile {
public:
TemporaryFile();
~TemporaryFile();
bool is_valid() const { return m_stream; }
FILE* stream() { return m_stream; }
String file_name() const { return m_file_name; }
void sync();
private:
FILE* m_stream { nullptr };
String m_file_name;
};
}
using AK::TemporaryFile;