Vidalia  0.3.1
file.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file file.h
13 ** \brief Functions and definitions for common file I/O operations
14 */
15 
16 #ifndef _FILE_H
17 #define _FILE_H
18 
19 #include <QString>
20 
21 
22 /** Create an empty file named <b>filename</b>. if <b>createdir</b> is true,
23  * then the full path to <b>filename</b> will be created. Returns true on
24  * success, or false on error and <b>errmsg</b> will be set. */
25 bool touch_file(const QString &filename, bool createdir = false,
26  QString *errmsg = 0);
27 
28 /** Creates all directories in <b>path</b>, if they do not exist. */
29 bool create_path(const QString &path);
30 
31 /** Expands <b>filename</b> if it starts with "~/". On Windows, this will
32  * expand "%APPDATA%" and "%PROGRAMFILES%". If <b>filename</b> does not
33  * start with a shortcut, <b>filename</b> will be returned unmodified. */
34 QString expand_filename(const QString &filename);
35 
36 /** Recursively copy the contents of one directory to another. The
37  * destination must already exist. Returns true on success, and false
38  * otherwise. */
39 bool copy_dir(const QString &source, const QString &dest);
40 
41 #endif
42