-
Notifications
You must be signed in to change notification settings - Fork 373
/
Copy pathFileUtils.h
42 lines (34 loc) · 1.26 KB
/
FileUtils.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
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2012 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_FILE_UTILS_H_
#define WT_FILE_UTILS_H_
#include <chrono>
#include <string>
#include <vector>
#include <Wt/WDllDefs.h>
namespace Wt {
namespace FileUtils {
extern WT_API
std::vector<unsigned char> fileHeader(const std::string &fileName,
unsigned size);
extern WT_API unsigned long long size(const std::string &file);
extern WT_API std::string* fileToString(const std::string &fileName);
#ifndef WT_TARGET_JAVA
extern WT_API std::chrono::system_clock::time_point lastWriteTime(const std::string &file);
#endif
extern WT_API bool exists(const std::string &file);
extern bool isDirectory(const std::string &file);
extern void listFiles(const std::string &directory,
std::vector<std::string> &files);
extern std::string leaf(const std::string &file);
// Returns a filename that can be used as temporary file
extern WT_API std::string createTempFileName();
extern void appendFile(const std::string &srcFile,
const std::string &targetFile);
}
}
#endif // WT_FILE_UTILS_H_