Fixed issue #3307: Abort Merge on a single file always results in a parameter error...
[TortoiseGit.git] / src / Utils / TempFile.h
blobb7d1e8ef987de4e70f04c77f27d4f84963ac5b5a
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008, 2012-2013, 2015-2017 - TortoiseGit
4 // Copyright (C) 2003-2006,2008,2015 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 #include "TGitPath.h"
23 #include "GitHash.h"
25 /**
26 * \ingroup Utils
27 * This singleton class handles temporary files.
28 * All temp files are deleted at the end of a run of SVN operations
30 class CTempFiles
32 private:
33 CTempFiles(void);
34 ~CTempFiles(void);
35 // prevent cloning
36 CTempFiles(const CTempFiles&) = delete;
37 CTempFiles& operator=(const CTempFiles&) = delete;
38 public:
39 static CTempFiles& Instance();
41 /**
42 * Returns a path to a temporary file.
43 * \param bRemoveAtEnd if true, the temp file is removed when this object
44 * goes out of scope.
45 * \param path if set, the temp file will have the same file extension
46 * as this path.
48 CTGitPath GetTempFilePath(bool bRemoveAtEnd, const CTGitPath& path = CTGitPath(), const CGitHash& hash = CGitHash());
50 private:
51 CTGitPathList m_TempFileList;