OSDN Git Service

Update CWindowsManagerDialog - check some pointers for null and made … (#824) (2)
[winmerge-jp/winmerge-jp.git] / Src / paths.h
1 /** 
2  * @file  paths.h
3  *
4  * @brief Declaration file for path routines
5  */
6 #pragma once
7
8 #include "PathContext.h"
9 #include "UnicodeString.h"
10
11 #ifndef MAX_PATH_FULL
12 #  define MAX_PATH_FULL 32767
13 #endif
14
15 namespace paths
16 {
17
18 /**
19  * @brief Possible values when checking for file/folder existence.
20  */
21 typedef enum
22 {
23         DOES_NOT_EXIST, /**< File or folder does not exist. */
24         IS_EXISTING_FILE, /**< It is existing file */
25         IS_EXISTING_DIR, /**< It is existing folder */
26         IS_EXISTING_DIR_ARCHIVE, /**< It is existing folder */
27 } PATH_EXISTENCE;
28
29 bool EndsWithSlash(const String& s);
30
31 PATH_EXISTENCE DoesPathExist(const String& szPath, bool (*IsArchiveFile)(const String&) = nullptr);
32 String FindFileName(const String& path);
33 String FindExtension(const String& path);
34 void normalize(String & sPath);
35 String GetLongPath(const String& szPath, bool bExpandEnvs = true);
36 bool CreateIfNeeded(const String& szPath);
37 PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveFile)(const String&) = nullptr);
38 bool IsDirectory(const String& path);
39 bool IsShortcut(const String& inPath);
40 String ExpandShortcut(const String &inFile);
41 String ConcatPath(const String & path, const String & subpath);
42 String GetParentPath(const String& path);
43 String GetLastSubdir(const String & path);
44 bool IsPathAbsolute(const String & path);
45 String EnsurePathExist(const String & sPath);
46 void SplitFilename(const String& s, String * path, String * name, String * ext);
47 String GetPathOnly(const String& fullpath);
48 bool IsURLorCLSID(const String& path);
49 bool IsDecendant(const String& path, const String& ancestor);
50 inline String AddTrailingSlash(const String& path) { return !EndsWithSlash(path) ? path + _T("\\") : path; }
51 String ToWindowsPath(const String& path);
52 String ToUnixPath(const String& path);
53
54 }