-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileManager.h
More file actions
53 lines (38 loc) · 1.21 KB
/
FileManager.h
File metadata and controls
53 lines (38 loc) · 1.21 KB
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
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <string>
#include <Windows.h>
#include <mmsystem.h>
class FileManager
{
private:
std::wstring m_working_directory;
std::wstring m_music_directory;
std::wstring m_main_ambience_theme;
public:
static const FileManager& getInstance()
{
static const FileManager instance;
return instance;
}
const std::wstring& workingDirectory() const { return m_working_directory; }
const std::wstring& musicDirectory() const { return m_music_directory; }
const std::wstring& mainAmbienceTheme() const { return m_main_ambience_theme; }
public:
FileManager(const FileManager&) = delete;
~FileManager() = default;
FileManager& operator = (const FileManager&) = delete;
private:
FileManager()
{
// The (absolute) path of the executable
WCHAR buffer[MAX_PATH] = { 0 };
GetModuleFileName(NULL, buffer, MAX_PATH);
std::wstring buffer_wstring(buffer);
std::wstring::size_type pos = buffer_wstring.find_last_of(L"\\/");
m_working_directory = buffer_wstring.substr(0, pos);
// The (absolute) path of the music files
m_music_directory = m_working_directory + L"\\Music";
// The file of the main ambience theme
m_main_ambience_theme = m_music_directory + L"\\lake_wind_ambience.wav";
}
};