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.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to the 00008 ** terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file file.h 00013 ** \version $Id: file.h 2362 2008-02-29 04:30:11Z edmanm $ 00014 ** \brief Functions and definitions for common file I/O operations 00015 */ 00016 00017 #ifndef _FILE_H 00018 #define _FILE_H 00019 00020 #include <QString> 00021 00022 00023 /** Create an empty file named <b>filename</b>. if <b>createdir</b> is true, 00024 * then the full path to <b>filename</b> will be created. Returns true on 00025 * success, or false on error and <b>errmsg</b> will be set. */ 00026 bool touch_file(QString filename, bool createdir = false, QString *errmsg = 0); 00027 00028 /** Creates all directories in <b>path</b>, if they do not exist. */ 00029 bool create_path(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(QString filename); 00035 00036 #endif 00037