mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 13:04:18 -04:00
New utility class to make sure temporary files are always deleted
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1043988 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
@ -25,3 +25,25 @@ inline void deleteFile(const string &filename)
|
||||
{
|
||||
remove(filename.c_str());
|
||||
}
|
||||
|
||||
class ScopedFileCopy
|
||||
{
|
||||
public:
|
||||
ScopedFileCopy(const string &filename, const string &ext)
|
||||
{
|
||||
m_filename = copyFile(filename, ext);
|
||||
}
|
||||
|
||||
~ScopedFileCopy()
|
||||
{
|
||||
deleteFile(m_filename);
|
||||
}
|
||||
|
||||
string fileName()
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
|
||||
private:
|
||||
string m_filename;
|
||||
};
|
||||
|
Reference in New Issue
Block a user