-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFilenameResolver.h
28 lines (21 loc) · 925 Bytes
/
FilenameResolver.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
#ifndef FILENAME_RESOLVER_H
#define FILENAME_RESOLVER_H
#include "Config.h"
#include <string>
#include <time.h>
class FilenameResolver
{
public:
// Based on the path given, attempts to resolve that to a file on disk. If possible, returns a string represnting the
// actual file to read. If not possible, returns an empty string.
static std::string resolve(const std::string& webPath, const Config& config,
std::string& redirectPath, time_t* mtime);
// Gets a content-type from a filename. Doesn't do any fancy inspection of the actual file, just looks at filename
// extension.
static std::string getContentType(const std::string& filename);
private:
static std::string resolveDir(const std::string& dirPath, const Config& config, time_t* mtime);
static std::string findNewestInDir(const std::string& webPath, const Config& config);
std::string m_basePath;
};
#endif