Vidalia
0.2.17
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file file.h 00013 ** \brief Functions and definitions for common file I/O operations 00014 */ 00015 00016 #ifndef _FILE_H 00017 #define _FILE_H 00018 00019 #include <QString> 00020 00021 00022 /** Create an empty file named <b>filename</b>. if <b>createdir</b> is true, 00023 * then the full path to <b>filename</b> will be created. Returns true on 00024 * success, or false on error and <b>errmsg</b> will be set. */ 00025 bool touch_file(const QString &filename, bool createdir = false, 00026 QString *errmsg = 0); 00027 00028 /** Creates all directories in <b>path</b>, if they do not exist. */ 00029 bool create_path(const QString &path); 00030 00031 /** Expands <b>filename</b> if it starts with "~/". On Windows, this will 00032 * expand "%APPDATA%" and "%PROGRAMFILES%". If <b>filename</b> does not 00033 * start with a shortcut, <b>filename</b> will be returned unmodified. */ 00034 QString expand_filename(const QString &filename); 00035 00036 /** Recursively copy the contents of one directory to another. The 00037 * destination must already exist. Returns true on success, and false 00038 * otherwise. */ 00039 bool copy_dir(const QString &source, const QString &dest); 00040 00041 #endif 00042