PPath.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PapillonCommon.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
20 class PStringList;
21 
27 class PAPILLON_API_CORE PPath
28 {
29 public:
33  static const PString& Separator();
34 
38  static PString TempPath();
39 
43  static PString CurrentPath();
44 
49  static bool SetCurrentWorkingDirectory(const PString& path);
50 
55  static PString GetAbsolutePath(const PString& path);
56 
70  static PString GetDirectory(const PString& path);
71 
81  static PString GetBaseName(const PString& path);
82 
94  static PString GetBaseNameWithoutEndDigits(const PString& path);
95 
105  static PString GetExtension(const PString& path);
106 
129  static PString Clean(const PString& dirPath, bool forceWinToLinux = true);
130 
144  static PResult ChangeRootDir(PString& path, const PString& oldRoot, const PString& newRoot, bool forceWinToLinux = true);
145 
150  static bool MakePath(const PString& dirPath);
151 
156  static bool RemoveNonEmptyDirectory(const PString& dirPath);
157 
162  static bool IsPathExist(const PString& path);
163 
167  static bool IsDirectory(const PString& path);
168 
172  static bool IsFile(const PString& path);
173 
177  static PStringList ListEntries(const PString& path, bool withAbsolutePath, bool filesOnly);
178 
182  static PString GetApplicationName();
183 
187  static PString GetApplicationDirectory();
188 
193  static PString Join(const PString& path1, const PString& path2);
194 
199  static PString Join(const PString& path1, const PString& path2, const PString& path3);
200 
205  static PString Join(const PString& path1, const PString& path2, const PString& path3, const PString& path4);
206 
211  static PString Join(const PString& path1, const PString& path2, const PString& path3, const PString& path4, const PString& path5);
212 
217  static PString Join(const PString& path1, const PString& path2, const PString& path3, const PString& path4, const PString& path5, const PString& path6);
218 
223  static PString Join(const PString& path1, const PString& path2, const PString& path3, const PString& path4, const PString& path5, const PString& path6, const PString& path7);
224 
229  static PString AddPathSeparatorIfMissing(const PString& s);
230 
231 private:
232  PPath();
233 };
234 
235 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PPath class is an helper class to get handle paths.
Definition: PPath.h:27
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PStringList class represents a list of PString; NOT thread-safe.
Definition: PStringList.h:26