1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 * helper class to handle path strings.
\r
28 static BOOL MakeSureDirectoryPathExists(LPCTSTR path);
\r
29 static void ConvertToBackslash(LPTSTR dest, LPCTSTR src, size_t len);
\r
31 * Replaces escaped sequences with the corresponding characters in a string.
\r
33 static void Unescape(char * psz);
\r
36 * Replaces non-URI chars with the corresponding escape sequences.
\r
38 static CStringA PathEscape(const CStringA& path);
\r
43 * returns the filename of a full path
\r
45 static CString GetFileNameFromPath(CString sPath);
\r
48 * returns the file extension from a full path
\r
50 static CString GetFileExtFromPath(const CString& sPath);
\r
53 * Returns the long pathname of a path which may be in 8.3 format.
\r
55 static CString GetLongPathname(const CString& path);
\r
58 * Copies a file or a folder from \a srcPath to \a destpath, creating
\r
59 * intermediate folders if necessary. If \a force is TRUE, then files
\r
60 * are overwritten if they already exist.
\r
61 * Folders are just created at the new location, no files in them get
\r
64 static BOOL FileCopy(CString srcPath, CString destPath, BOOL force = TRUE);
\r
67 * parses a string for a path or url. If no path or url is found,
\r
68 * an empty string is returned.
\r
69 * \remark if more than one path or url is inside the string, only
\r
70 * the first one is returned.
\r
72 static CString ParsePathInString(const CString& Str);
\r
75 * Returns the path to the installation folder, in our case the TortoiseSVN/bin folder.
\r
76 * \remark the path returned has a trailing backslash
\r
78 static CString GetAppDirectory();
\r
81 * Returns the path to the installation parent folder, in our case the TortoiseSVN folder.
\r
82 * \remark the path returned has a trailing backslash
\r
84 static CString GetAppParentDirectory();
\r
87 * Returns the path to the application data folder, in our case the %APPDATA%TortoiseSVN folder.
\r
88 * \remark the path returned has a trailing backslash
\r
90 static CString GetAppDataDirectory();
\r
93 * Replaces escaped sequences with the corresponding characters in a string.
\r
95 static CStringA PathUnescape(const CStringA& path);
\r
96 static CStringW PathUnescape(const CStringW& path);
\r
99 * Escapes regexp-specific chars.
\r
101 static CString PathPatternEscape(const CString& path);
\r
103 * Unescapes regexp-specific chars.
\r
105 static CString PathPatternUnEscape(const CString& path);
\r
108 * Returns the version string from the VERSION resource of a dll or exe.
\r
109 * \param p_strDateiname path to the dll or exe
\r
110 * \return the version string
\r
112 static CString GetVersionFromFile(const CString & p_strDateiname);
\r