-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileSystem.cpp
More file actions
43 lines (38 loc) · 1.02 KB
/
Copy pathFileSystem.cpp
File metadata and controls
43 lines (38 loc) · 1.02 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
//
// Created by void on 20/05/2026.
//
#include "FileSystem.h"
#include "State.h"
std::string FileSystem::GetSystemTempPath() {
#ifdef _WIN32
char tempFolder[MAX_PATH];
GetTempPathA(MAX_PATH, tempFolder);
return std::string(tempFolder);
#else
return "/tmp/";
#endif
}
void FileSystem::ChangeWatchedFile(const std::string& path) {
if (State.watch != nullptr) {
State.watch.reset();
}
TraceLog(LOG_INFO, "Adding a file watch on %s", path.c_str());
State.watch = std::make_unique<filewatch::FileWatch<std::string>>(
path,
[](const std::string& changedPath, const filewatch::Event change_type) {
switch (change_type) {
case filewatch::Event::modified:
State.needsReload = true;
break;
default:
break;
}
}
);
}
void FileSystem::StopWatching() {
TraceLog(LOG_INFO, "Removing file watch");
if (State.watch != nullptr) {
State.watch.reset();
}
}