-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileTools.h
43 lines (34 loc) · 1.58 KB
/
FileTools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _FILETOOLS_H_
#define _FILETOOLS_H_
#include "ToolsDefine.h"
TOOLSPACE_BEGIN
class FileTools
{
FileTools();
~FileTools();
public:
// Function: Returns everything, including the trailing path separator,
// except the filename part of the path.
// Example: "/foo/bar/baz.txt" => "/foo/bar/"
static DString extractDirectory(const DString & in_strPath, char in_cDelimiter = '/');
// Function: Returns only the filename part of the path.
// Example: "/foo/bar/baz.txt" => "baz.txt"
static DString extractFilename(const DString & in_strPath, char in_cDelimiter = '/');
// Function: Returns the file's extension, if any. The period is
// considered part of the extension.
// Example: "/foo/bar/baz.txt" => ".txt"
// "/foo/bar/baz" => ""
static DString extractFileExtension(const DString & in_strPath, char in_cDelimiter = '/');
// Function: Modified the filename's extension. The period is considered
// part of the extension.
// Example: "/foo/bar/baz.txt", ".dat" => "/foo/bar/baz.dat"
// "/foo/bar/baz.txt", "" => "/foo/bar/baz"
// "/foo/bar/baz", ".txt" => "/foo/bar/baz.txt"
static DString changeFileExtension(const DString & in_strPath, const DString & in_strExt,
char in_cDelimiter = '/');
// Function: Make directory recursively.
// Use dos command or shell command.
static bool makeDirectory(DString in_strDirectory);
};
TOOLSPACE_END
#endif